Can someone help me with 5/16?


#1

On line 1, create a variable named parrot and set it to the string "Norwegian Blue". On line 2, type len(parrot) after the word print, like so: print len(parrot). The output will be the number of letters in "Norwegian Blue"!

var = "parrot" = str("Norwegian Blue")
print len(parrot)
What did I do wrong?


#2

In Python we create variables using this syntax:

name_of_variable = value

We don't use any special keywords like var. And the name of the variable cannot be enclosed in quote marks.

Furthermore, this expression:

str("Norwegian Blue")

is redundant. "Norwegian Blue" is already a string (you can tell this by looking at quote marks) so you don't have to cast it into the string type.

parrot = "Norwegian Blue"

#3

Thank you :grinning:


#4

You're very welcome :panda_face:


#5

eat some hot dogs hjgfhfdhfgfdhfshbfhbnfnbfhngfnfgnfgnbhotdogsfhrjhfgghrjy


#6

thank you :grinning: :grinning: :grinning: :grinning: :grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning:grinning: :grinning: :grinning: :grinning


#7

That is very helpful factoradic.I was stuck on this code for a long time. Then I read this reply.

Draco


#8

I am really glad you found it helpful :smile: Good luck with next exercises!


#9

I had a similar problem and in mine the error message reads:
Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: invalid syntax (python, line 2)
When i consistently type in:
1)parrot = "Norwegian Blue"
2) print len(parrot)= 13
HELP PLEASE!