velious
02-23-2004, 08:53 PM
this code is being difficult with me. It says that the " mark by the word "are" is wrong..but i dont know why. I tried to seperate the " marks and commas but that didn't seem to help much.
print "Welcome to my program "
print "Please type your name, age, city, state, and zip,"
name = input("name ")
age = input("age ")
city = input("city ")
state = input("state ")
zip = input("zip ")
print "Your name is", name "you are", age "years old and live in", city , state, zip
print "Thank you for joining us!."
Jason
02-23-2004, 11:37 PM
print "Welcome to my program "
print "Please type your name, age, city, state, and zip,"
name = input("name ")
age = input("age ")
city = input("city ")
state = input("state ")
zip = input("zip ")
print "Your name is", name "you are", age "years old and live in", city , state, zip
print "Thank you for joining us!."
try adding the line
print "Your name is %s your age is %s years old and live in %s %s %s" % (name, age, city, state, zip)
other wise to use your print statment, don't use the double quotes, use single quotes and it should work.
Jason
velious
02-24-2004, 02:09 AM
Jason, it did not work, but thats ok..i'll keep working at it.. was wondering what does the %s mean?
Jason
02-25-2004, 12:23 AM
%s basically says you are using a string variable....so if you were using an int it would be %i and double/floats are %f extended florats are %ef or something...but then at the end you say what variables go in the order in which you use the variables...
print "%s %i %s %s %i " % (name, age, city, state, zip)
where name = string
age = int
city = string
state = string
zip = int
and they correspond to the porper var call, maybe try taking the '%' out that seperates the vars and the printing string.....
Jason