File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed
Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 1+ def greet (name , verbose = False ):
2+ if verbose :
3+ print (f"Hello, { name } ! It's great to see you!" )
4+ else :
5+ print (f"Hello, { name } !" )
6+
7+
8+ greet ("Pythonista" )
9+ greet ("Pythonista" , verbose = True )
Original file line number Diff line number Diff line change @@ -15,9 +15,9 @@ def inner_func():
1515 # Local scope
1616 local_variable = "local"
1717 print (f"Hi from the '{ local_variable } ' scope!" )
18+ print (f"Hi from the '{ global_variable } ' scope!" )
19+ print (f"Hi from the '{ nonlocal_variable } ' scope!" )
1820
19- print (f"Hi from the '{ global_variable } ' scope!" )
20- print (f"Hi from the '{ nonlocal_variable } ' scope!" )
2121 inner_func ()
2222
2323
Original file line number Diff line number Diff line change 1+ toggle = True
2+
3+ for _ in range (4 ):
4+ if toggle :
5+ print (f"✅ toggle is { toggle } " )
6+ print ("Do something..." )
7+ else :
8+ print (f"❌ toggle is { toggle } " )
9+ print ("Do something else..." )
10+ toggle = not toggle
You can’t perform that action at this time.
0 commit comments