Need help please


#1



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


What am i doing wrong


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


#2

re-usability of a variable.

suppose I have created a variable x..

x = 45

so now to print it ,I will use of variable as my variable stores/tags the value..

like this..

print x # it will print 45

print x + 5 #it will print 50

You see Im not using the value now?but variable (name of value) associated with this value?


#3

will you explain it a bit easier im still kinda a noob at this


#4

Hi @lootmonkey1337
suppose I have told to save my name in a variable name
I'd do this..

name = "GreenTree"

now if someone says to print it? I'd do this..

print name #using variable -more effective

You can directly print the name like this..

print "GreenTree" #using value

In the following exercise you've to use variable to print the value.

My variable name stores value of my name.
Note - I did not just used GreenTree but I surrounded them between quotes like this.. "GreenTree".

When we work with text in python,We don't just use it but we surround them using double or single quotes (You can even use triple quotes) like this..

name = "GreenTree" #doublequote
or
name = 'GreenTree' #singlequote
or
name = """GreenTree""" #triplequote
or even
name = '''GreenTree'''

for python all of them are same.
when python executes your program and sees quotes "It says ,Oh it's a starting of text and when it hits end quote of string it understands that text has just ended"
That's how python works with texts.

I hope it helps!
do reply ! :slight_smile:


#5

thank you and it helped a lot :slight_smile:


#6

you are the most helpful person i have meet on this


#7

There're are many cool and helpful people on this forum! :slight_smile:
keep up the good work! :thumbsup:


#8

if i need any more help i will be sure to ask and thank you again :slight_smile:


#9

One final question you play xbox or pc?

GT:lootmonkey1337

Steam:lootmonkey1337


#10

Declare a variable called the_machine_goes and assign it the string value "Ping!" on line 5.
Go ahead and print the_machine_goes in line 6.

what is the end product suppose to look like


#11

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