+ 1

Why does this code not work: value=[1] print("I have")+(len(value))+("egg")

value=[1] print("I have")+(len(value))+("egg")

23rd Aug 2016, 8:50 PM
Ezie
2 Answers
+ 4
because you closed brackets too early. your print function ends after printing "I have", and then it adds len() to print's return, then adds a string to integer and here it crashes. try this: print("I have " + str(len(value)) + " egg")
23rd Aug 2016, 8:56 PM
Demeth
Demeth - avatar
0
Thanks!
23rd Aug 2016, 9:18 PM
Ezie