- 1
Python
Çan someone tell me how the answer to this Is 20? >>>spam=2 >>>eggs=3 >>>del spam >>>spam=4 >>>eggs=5
7 odpowiedzi
+ 1
With spam = 4 you give it a new value that would overwrite the previous 2 even if you didnt delete it before, same as eggs, it gets a new value at the end.
So even with just the last two lines you would already get 20.
spam = 4
eggs = 5
result = spam*eggs
print(result) //20
+ 1
Im assuming they said spam*eggs afterward?
+ 1
You basically just declared some variables, the only way you can get 20 from this is if you multiply spam and eggs and print the result.
+ 1
It removes the value of the variable spam so if you tried to print it, it would throw an exeption saying spam is not defined.
0
yes Thomas Williams
0
Also what does delspam indicate?
0
Sohcahtoa so does that mean that it deletes the previous value? and thats why the answer of spam*eggs is 20?