+ 1
print(Spam*3)... Whether quotes is compulsory here?đ
12 Answers
+ 12
Unless you declared Spam perviously, it won't work with that line by its self(like sun said). You'll get a declaration error saying Spam is undefined.
+ 6
Spam have to be variable . if not you need quotes
+ 1
I run it on my trusty bpython3 and its not running without quotes
+ 1
its not running , are u using sololearn compiler ?
+ 1
yeah.. sololearn python
+ 1
its not working in my sololearn compiler as well as main python3 on pc
+ 1
yeah. its my mistake only.. i dint notice that they gave some value for spam in the beginning...
+ 1
now i understood.. thanks.. for ur explanation
+ 1
because spam="eggs"
0
spam. is a string so obviously a string needs qoutes right.. but without quotes its working.. i cant understand why
0
but for me its running...bro u gave print before that
0
spam='hi'
print(spam*3)
in here spam is already a string so that is why it will print hihihi
----------
spam='hi'
print ('spam'*3)
this will print spamspamspam