0

why this error?

>>> name = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" >>> print len(name) SyntaxError: invalid syntax >>>

7th Sep 2017, 7:42 PM
Rohit Sajwan
7 Réponses
+ 2
easy lion = name[11] + name[8] + name[14] + name[13] print(lion)
7th Sep 2017, 8:06 PM
Joshua
Joshua - avatar
+ 2
try this use print(len(name))
7th Sep 2017, 7:47 PM
Joshua
Joshua - avatar
+ 2
yes, the parentheses are very important to the print method
7th Sep 2017, 7:58 PM
Joshua
Joshua - avatar
+ 1
Thanks Joshua. It worked. But did I have to do it?
7th Sep 2017, 7:49 PM
Rohit Sajwan
+ 1
how will you print LION from name? print name[0] will print A how can i print multiple items
7th Sep 2017, 8:01 PM
Rohit Sajwan
+ 1
Don't attribute yourself the best answer mark (green tick): it doesn't give you any XP, rather show a bad image of you (shame), and almost pervert this feature purpose, which is to highlight useful answer in addition to not be respectful of people who are spending time to help others @@
7th Sep 2017, 8:44 PM
visph
visph - avatar
+ 1
I'm not sure which language you're using but it would be something like this: print(name[0] + name[1] + name[2]) This would output ABC from your string. + is how you would do it in c#, other languages have different concatenation characters (e.g. & in VB iirc).
8th Sep 2017, 4:25 AM
Sean Douglas
Sean Douglas - avatar