can someone help me verify that this is the right/ or one of the right ways to code the "questions/answers" for problem set 0 this would be a great help to me. >>> red = "Enter your date of birth:" >>> blue = "02/17/92" >>> yellow = "Enter your last name:" >>> purple = "Franks" >>> print (red) Enter your date of birth: >>> print (blue) 02/17/92 >>> print (yellow) Enter your last name: >>> print (purple) Franks >>> print (purple, blue) ('Franks', '02/17/92')
Well, you would generally make a .py file and have it take in the name, etc. using raw input. Then print hte result.
so this is technically right but not in the right format?
Well, you are not using the input function.
Things like: ``` firstname = raw_input('What is your first name?') print (firstname) ```
and then to answer that question i would write? name = raw_input('Cory') print (name)
raw_input prints out the prompt: varaiable = raw_input('Prompt') It then assigns whatever the person types in to the variable.
Input methods are a way to make a program reusable. When you hard code in the name, what happens if the next person to use the program has a different name? By asking for the name, you let anyone use the program.
soo Cory = raw_input('Enter your first name') would produce my name if i say print (Enter your first name) or no? P.s about all the repetitive questions, I'm having a hard time with the whole x = raw_input() part and getting the results i need
oh ok i think i might understand let me work this out and ill repost new code or com back here
the only part i don't under stand how to do is get it to print both answers on the same line for that last part
Try this and see what you get, then think about it: print ('a' + 'b')
so heres what i have now using raw input birthday = raw_input('Enter your date of birth:') Enter your date of birth:02/17/92 >>> lastname = raw_input('Enter your last name:') Enter your last name:Franks >>> print (lastname + birthday) Franks02/17/92 grants theres no space between my last name and birthday because i can't figure out how to get one without it ending up like this >>> print (lastname, birthday) ('Franks', '02/17/92')
Just add the space. print (lastname + ' ' + birthday)
oh really i didn't know you could do that, thanks for being very patient with me man
It is now we learn. Trial and error. =)
yeah true
Join our real-time social learning platform and learn together with your friends!