Strings Strings can be enclosed in single quotes (‘..’) or double quotes (“..”). The print() function is used to show the output of strings. Examples Single quotes >>> 'Single quotes test' 'Single quotes test' Double quotes >>> "Double quotes test" 'Double...
Lists The Python list, is a sequence of values, separated by commas between square brackets. Lists can have values of different data types. Example Extract all values from a list with python >>> my_list = [1, 5, 7, 21, 33] >>>...
IF statement IF statement – with the IF statement you can use optional parts like elif or else. The keyword elif is short for else if keyword. Examples >>> c = 10 >>> if c < 0: print('Negative value') elif c...
FOR statement The FOR statement iterates over the items of a list or a string, in the order that they appear in the list or string. Examples >>> my_list = ['Learn', 'python', 'language'] >>> for n in my_list: print(n) Learn python...