Python basics

Variables

Python variables are very easy to set up and very flexible.

a = 10 print(a) # 10 a = 2.5 print(a) # 2.5 a += a print(a) # 5.0 a = [ 1, 2, 3, 4, 5 ] print( a[2] ) # 3 len(a) # 5 a = "hello" a += " world" print(a) # hello world len(a) # 11 print(a[10]) # d