1Python Variables are like boxes that store some values
2
3Example of delcaring a variable:
4
5number = 1
6name = "Python"
7isUseful = True
8number_2 = 1.5
1x = str(3) # x will be '3'
2y = int(3) # y will be 3
3z = float(3) # z will be 3.0
4
5print(type(x))
6print(type(y))
7print(type(Z))
1#Varibles Guide:
2a = 5 #NUMBER
3b = "Varibles!" #STRING
4c = True #BOOLEN Hey, this is an edit, sorry for having it as true not True, caps matter.
5d = False #BOOLEN Hey, this is an edit, sorry for having it as false not False, caps matter.
1def scope_test():
2 def do_local():
3 spam = "local spam"
4
5 def do_nonlocal():
6 nonlocal spam
7 spam = "nonlocal spam"
8
9 def do_global():
10 global spam
11 spam = "global spam"
12
13 spam = "test spam"
14 do_local()
15 print("After local assignment:", spam)
16 do_nonlocal()
17 print("After nonlocal assignment:", spam)
18 do_global()
19 print("After global assignment:", spam)
20
21scope_test()
22print("In global scope:", spam)
23