Strings - need help on this part


#1

On line 3, create the variable my_string and set it to any string you'd like.
On line 4, print the length of my_string.
On line 5, print the .upper() case version of my_string.

i need help on this part


Len(str) and str.upper(),
#2

Python variable names can be anything we like to give them, but should describe the object they reference so the reader can attach meaning. Normal variables are written in lower case, do not start with a number, and contain no special characters except underscore.

Eg.

>>> my-string = "string"
SyntaxError: can't assign to operator

>>> my_string = "string"
>>>

In this assignment, the variable name we are given is appropriate since we are asked to give it a string value.

my_string = "This is a string value."

Give it a try, and see if you can complete the last two steps. Be sure to read the lesson text carefully, and don't be afraid to look for documentation online.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.