i dont get the spam and eggs | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

i dont get the spam and eggs

dont know how it ends up as a number

8th Sep 2016, 12:28 PM
Reece Summers
Reece Summers - avatar
3 Answers
+ 1
Are you talking about the last question of the Variable lesson? What is the output of this code? >>> spam = 2 >>> eggs = 3 >>> del spam >>> eggs = 4 >>> spam = 5 >>> print(spam*eggs) spam and eggs are here names for integer variables, ie they hold a number. Here are an example of variables holding text: >>> spam = "foo" >>> eggs = "bar" >>> print(spam) foo >>> print(eggs) bar Text is represented by a chain of characters between a pair of quotes or double quotes, and that is called a string. Another example, with spam and eggs as text and not variable names: >>> print("spam") spam >>> print("eggs") eggs
8th Sep 2016, 12:49 PM
Zen
Zen - avatar
0
What is the output of this code? >>> spam = 2 >>> eggs = 3 >>> del spam >>> eggs = 4 >>> spam = 5 >>> print(spam*eggs) ans is 20
22nd Jul 2017, 8:32 AM
Shahin Hossain
Shahin Hossain - avatar
0
@Shahin Hossain.....thanks, 20 is the correct answer
7th Jan 2019, 10:05 AM
Samuel Usen
Samuel Usen - avatar