On 09/19/2012 09:21 AM, Lamar iVisionary wrote:
Trying to write the following in Python.
"Hi, my name is Bob!",
.What is your name?
print " Hi," + "my name is Bob!,
strname= raw_input ("What is your name?")
Hi #######, nice to meet you!
I'm 18. How old are you?
I cant figure out to get the stored variable / (Name) to appear when I
respond Hi ####, nice to meet you.
Any help with this would be great.
Just a beginner here myself but I think you could just use a string
substitution to accomplish what you want.
For example:
sayWord = "Ni!"
print "The knights who say %s" % sayWord
Will produce:
The knights who say Ni!
You can do it directly too but usually replacing with a variable gives
more flexibility.
thomas
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor