File tree Expand file tree Collapse file tree 6 files changed +50
-4
lines changed
Expand file tree Collapse file tree 6 files changed +50
-4
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ def getAnswer(answerNumber):
1919 elif answerNumber == 9 :
2020 return 'Very doubtful'
2121
22- r = random .randint (1 ,9 )
23- fortune = getAnswer (r )
24- print (fortune )
25-
22+ #r = random.randint(1,9)
23+ #fortune = getAnswer(r)
24+ #print(fortune)
25+
26+ print (getAnswer (random .randint (1 ,9 )))
2627
Original file line number Diff line number Diff line change 1+ def spam ():
2+ eggs = 'spam local'
3+ print (eggs ) #prints 'spam local'
4+ def bacon ():
5+
6+ eggs = 'bacon local'
7+ print (eggs ) #prints 'bacon local'
8+ spam ()
9+ print (eggs ) #prints 'bacon local'
10+
11+ eggs = 'global'
12+ bacon ()
13+ print (eggs ) #prints 'global'
Original file line number Diff line number Diff line change 1+ def spam ():
2+ global eggs
3+ eggs = 'spam'
4+
5+ eggs = 'global'
6+ spam ()
7+ print (eggs )
Original file line number Diff line number Diff line change 1+ def spam ():
2+ global eggs
3+ eggs = 'spam' #this is global
4+
5+ def bacon ():
6+ eggs = 'bacon' #this is local
7+ def ham ():
8+ print (eggs ) #this is global
9+
10+ eggs = 42 #this is global
11+ spam ()
12+ print (eggs )
Original file line number Diff line number Diff line change 1+ def spam ():
2+ print (eggs ) #ERROR!
3+ eggs = 'spam local'
4+
5+ eggs = 'global'
6+ spam ()
Original file line number Diff line number Diff line change 1+ def spam (divideBy ):
2+ return 42 / divideBy
3+
4+ print (spam (2 ))
5+ print (spam (12 ))
6+ print (spam (0 ))
7+ print (spam (1 ))
You can’t perform that action at this time.
0 commit comments