Python int to string
Python int (or any other data type like float) needs to be converted to string before we can do concatenation operation using plus (+). It read more
Python dictionary basics
Python dictionary (associative arrays) – some basic operations. Initialize dictionary Check if a key exists access value for a key list length/size using len() len() read more
Python type – find type of a variable
Python in-built function type() can be use to find type of any variable or value. Example – type() of string variable Example – type() of read more
Python initialize large list with same value
To initialize a large list with same value (all items having same value), the following syntax can be used. a = [val] * num_items Example
Python array slice
Slicing a list (array) in python is very handy way to get a sub list of an array. Its syntax is ## slice from start read more
Python list/array – remove an item
To remove an item from python list method pop([i]) can be used. Remove last item Remove first item Remove ith item
Python list – append or prepend a value
Appending or prepending a value to a list in Python. Append value Prepend value
Python list (array) basics
Python list (or array) – some basic operations. Initialize list access ith item access last item list length/size using len() Note than len() can also read more
Python string contains check
To check if a string is part of another string (case sensitive) we can use these approaches Using in operator Using string find() method ## read more
Python string lowercase and uppercase
To convert a string to lowercase of uppercase following code can be used: s_lower = s.lower() s_upper = s.upper() string lowercase example string uppercase example