Printing Variables


#1

"""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_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!!!


#2

Remove the bottom line, and change it to

print the_machine_goes

#3

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.
jibblyj


#4

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.


#5

This is what it looks like jibblyj


#6

Replace lines 5,6 and 7 with

the_machine_goes = "Ping!"
print the_machine_goes

#7

i'm with the exactly problem :confused:


#8

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


#9

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


#10

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


#11

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


#12

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


#13

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


#14

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


#15