+ 2
>>>spam=2 >>>egg=3 >>>del spam >>>spam=4 >>>egg=5 >>>print(spam*egg) output=20
plz help me I did'nt understood
7 Answers
+ 21
1. you create a variable spam with initial value 2
2. you create a variable egg with initial value 3
3. you delete spam (his value is lost)
4. you create a new variable spam with value 4
5. you change the value of egg (you replace it with 5)
at this step, you have spam=4, egg=5
6. you print spam*egg (=20)
+ 4
no matter what you do before, last assignment to a variable is what counts. so, last assignmnet to spam is 4, last assignment to egg is 5 which then gives 4*5=20.
+ 2
I think you got the wrong book...
Dont import Cooking receipts for testing python ;)
+ 1
It will take the last assigned variable because u are in interactive mode.there are two modes in phythod interactive and script mode.in script mode whole program will execute.but in interactive mode it gave you the results whose value u assinged at last of u r code
0
to x complete?
0
It is 20 bro
0
20