Learn String Manipulation by Building a Cipher - Step 2

Tell us what’s happening:

there is a error some i get the message my code has not passed but cant find the error

# User Editable Region

String_1 = "I am a string"
String_2 = 'I am also a string '
String_3 = 'This is not valid'

# Deleting the 'number' variable (if it exists)
if 'number' in locals():
    del number

# Declare a new variable called 'text'
text = "Hello, World!"

# Printing the values to verify
print(String_1)
print(String_2)
print(String_3)
print(text)
string_1 = "i am a string"
string_2 = 'I am also a string'
string_3 = 'This is not '
text= " hello world "

# User Editable Region

String_1 = "I am a string"
String_2 = 'I am also a string '
String_3 = 'This is not valid'

# Deleting the 'number' variable (if it exists)
if 'number' in locals():
    del number

# Declare a new variable called 'text'
text = "Hello, World!"

# Printing the values to verify
print(String_1)
print(String_2)
print(String_3)
print(text)
string_1 = "i am a string"
string_2 = 'I am also a string'
string_3 = 'This is not '
text= " hello world "

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 2

Tell us what’s happening:

Describe your issue in detail here.
i am getting an error message but not sure where my mistake is

Your code so far

text = “hello world”

string_1 = “I am a string”

string_2 = ‘I am also a string’

string_3 = ‘This is not valid’


# User Editable Region

text = "hello world"
string_1 = "I am a string"
string_2 = 'I am also a string'
string_3 = 'This is not valid'


# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 2

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Welcome to our community!

The instructions: " Delete your number variable and its value. Then, declare another variable called text and assign the string Hello World to this variable."

Reset the step.

  • Delete the existing code line
  • Declare a new variable called ‘text’
  • Assign a string value “Hello World” to the ‘text’ variable.

That is all you have to do in this challenge.

1 Like

what error message are you getting?

sorry, your code does not pass. Hang in there.

You should assign the string Hello World to your text variable.

orry, your code does not pass. Hang in there.

You should assign the string Hello World to your text variable.

this step is case sensitive so u should type exact string as per given in the instruction

Tell us what’s happening:

Describe your issue in detail here.

Your code so far


# User Editable Region

String_1 = "I am a string"
String_2 = 'I am also a string'
String_3 = 'This is not valid'

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn String Manipulation by Building a Cipher - Step 2

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Hello bgpeze,

It looks like you fixed the variables in the example. But the question asked you to make a variable called text and assign the string Hello World to this variable.

ok how do what you are explaining

string_1 = "I am a string"

string_2 = 'I am also a string'

string_3 = 'this is not valid'

# declare a new variable called 'text' and assign the string "hello world"

text = "hello world"

i did this but got the same error message

This doesn’t have the same capatalisation as the question is asking. (Also make sure to keep the number variable, don’t remove what was already there.)

do i also continue from step one or start over with the new lines instructed

i did this and still got an error message

string_1 = "I am a string"

string_2 = 'I am also a string'

string_3 = 'this is not valid'

# declare a new variable called 'text' and assign the string "hello world"

text = "hello world"

You could reset the step, then write the text variable again with the right capitalisation.

Not hello world, but Hello World, see the capitalized letters

I have merged together your three topics, please do not create multiple topics to ask for help with the same step, thank you!

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').