+ 2
Why did eggs change in value?
There was a del for spam but no del for eggs why did eggs change in value?
4 Antworten
0
>eggs=2
>spam=3
>del spam
>spam=4
>eggs=5
>print(spam* eggs)
Answer was 20, since there was no del eggs, after del spam, do all values change after del spam?
0
You can reassign the variable as many times in the program. Check the lesson 2 of the variables unit
0
Okay, I got it. I wish the wording was a little more intuitive, it would help with clearer, instructions...
As you define a variable, it is not being promted to compute, rather define... when you write a new line, it replaces the old value...
So 5*4 is all you have to figure in this problem. the previous values are over written by the later commands of defining...
its really easy. but... it also leads a wide open door to those who over think... or think deeply... without simple instructions.
A lack of experience could be my issue, This is my first computer language I decided to learn so. Take me with a grain of salt.
- 1
Here is why
Because If u say
>eggs=2
>spam=3
>del eggs
>print (spam+eggs)
Error