And Now, For Something Completely Familiar


#1



https://www.codecademy.com/courses/python-beginner-sRXwR/4/1?curriculum_id=4f89dab3d788890003000096#

Write your code below, starting on line 3!

x='my_string'
print len(x)
print x.upper()

Oops, try again. Did you create a variable called my_string?


Where am I going wrong?


Replace this line with your code.


#2

you created a variable called x and gave it a value of 'my_string'


#3

If I reverse it, it says I cant assign to literal.


#4

but my_string should be the variable (without apostrophes, otherwise it would be a string), and you should give it a string value


#5

Write your code below, starting on line 3!

my_string
print len(my_string)
print my_string.upper()

comes back with

Traceback (most recent call last):
File "python", line 3, in
NameError: name 'my_string' is not defined


#6

to name a variable you need to do:

variable_name = 'value'

you need to give it a value, in this case a string and a variable named my_string


#7

thank you so much! I appreciate the help!


#8