len()
lower()
upper()
str()
The first one, len() is pretty self explanatory, to me at least. Using this in your line of code means that you would like the length of the characters you choose to appear on screen.
On this one, CA has been helpful and given us instructions and a near blank screen as you can see.
The instructions read to create a variable named parrot and set it with the string Norwegian Blue the to use len(parrot) and add print so it prints the amount of characters in the string, see below.
As you can see, using the code: parrot = "Norwegian Blue"
print len(parrot)
It prints 14, which Norwegian Blue (including the space), is 14 characters long.
So you see, you create the variable and the string to go on with it, then on the next line you tell it to print the length of the variable named inside the brackets.
Hope you understood that, leave a comment if you didn't!
No comments:
Post a Comment