Creating variable and setting it to a string


#1



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

The instructions are not clear on what to do. "In line 3, create the variable my_string and set it to any string you'd like."


"my_string" = 'something'


#2

a string will be surrounded in either ' ' or " "
A variable name will not.

a_variable = "a string"

Is an example of the format
Variables hold string...amongst other types


#3

it came back with: " 'str' object has no attribute 'length'


#4

copy and paste your code here


#5

my_string = "Hello"
print my_string.length()
print my_string.upper()


#6

Remember string methods

len("Charlie")
"Delta".upper()
"Echo".lower()

One of your method calls looks different.


#7

The feedback is quite unclear, but are you referencing how i made the 1st line of code?


#8

I'm telling you that you're calling the method to determine the length of string incorrectly.

length() isn't a thing, how does the example show you to do this?


#9

Ok thanks for the clarification.


#10

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