Printing Variables

“”“Assign the string “Ping!” to
the variable the_machine_goes on
line 5, then print it out on line 6!”""

print “the_machine_goes_ping”
print “Ping!”

This is my code and this is the error message.

Oops, try again. Make sure you print the_machine_goes, and not the literal string “Ping!”

without the print “Ping!” this is the error message.
Oops, try again. Did you remember to print out “Ping!”?

Please help!!!

Remove the bottom line, and change it to

print the_machine_goes
1 Like

Oops, try again. Your code looks a bit off. Check the Hint if you need help! Your code threw the following error: name ‘the_machine_goes_ping’ is not defined.
Thats what happens if i take the speech marks out.

This is the line where you define the variable. Don’t remove this - If you did, put it back in before you print the value of the variable.

1 Like

This is what it looks like jibblyj

Replace lines 5,6 and 7 with

the_machine_goes = "Ping!"
print the_machine_goes

i’m with the exactly problem :confused:

I am getting extremely frustrated I am following the instructions but the I am not getting the desired out put please some one tell me what to do as I am having no clue and even the hint section is not helping as it is only telling about the variable declaration which I am sure I have done it right just can’t able to solve the print problem

Ok, let’s make a bit of order here.
As the exercise suggest, “Printing variables” that’s the exact goal that you have to reach there.

First of all declaring a variable:

the_machine_goes = #We’ve declared the variable this way.

Now it say to ASSIGN to the variable the string value “Ping!”, You don’t have to add it in your print as you did
in line 6: print "the_machine_goes_ping, but exactly as you did in line 5!

the_machine_goes = “Ping!” #We’ve assigned the string value “Ping!” to the variable

Lastly it ask to print the variable, whenever you want to print out a variable remember to never put it between ’ ’ or " ", python treat those as STRINGS, to pring a string stored in your variable you do:

print the_machine_goes

and that’s it!

I hope this is clearly enough, whether you need any help please feel free to ask again whenever you want! and let me know if everything is clear @qutayba_619hotmail_c @lucasmiguins


I was having the same problem. The answer is the freaking capital P in print that’s messing up with you.

You still have the problem or is it resolved? If you have problem please post code.

thank you! I’m not sure how the capital P got in there, but…

They have to do the following …

“”“Assign the string “Ping!” to
the variable the_machine_goes on
line 5, then print it out on line 6!”""

the_machine_goes = “Ping!”
print the_machine_goes

1 Like

thank you everyone for the help because I started to get stuck myself but this was helpful!