Can anyone help me understand unit 1's problem set 1? the problem set with the whole "enter your bdate of brith, enter your last name?" thanks!
the prob set is called: Introduction to Python and IDLE
The solution has been included, have you compared your code with that? What precisely are you having an issue understanding?
I could not find a solution for this one to compare against but was able to create working code. What is the problem you're having with this set?
I do not understand anything to do with this set. Everytime I type in anything in IDLE, all I get is this invalid syntax message. I have to type in the question what is your birthdate, and then what is your last name. I typed in both and received the invalid syntax msg. and when I typed in numbers, same thing.
the first thing to do would be to open a file to put your code in. you don't want to type everything in the shell :) have you watched the lecture video 1 and 2? there it is explained how to use the raw_input thing
yea i watched the videos and i'm still confuded haha
could you post your code?
ok, this is all I'm typing in: raw_input "what is your date of birth" raw_input "what is your last name"
and i get invalid syntax error with that but im not sure what else to do
i understand nothing of this problem set, unfortunately...
you should type something like this x = float(raw_input('Enter your date of birth: ')) y = raw_input('Enter your last name: ') print y,x
sorry, without the float its right
thanks so much!
it worked finally haha!
raw_input() is a function. Functions, in most languages, are called with the function name and arguments/parameters inside of parentheses. In this case, the prompt that you want displayed is the argument. Functions can return a value. In this case, what the user types in is returned as a string. Programming languages are formal languages. In simple terms, a formal language has one way that it works, and everything else is rejected, syntax errors.
I am having some problems getting the output from this problem to display properly. I get the birth date and last name to display, but i can't figure out how to get a space between those two values. Here is my code: question = "What is your birthdate?" print (question) answer = raw_input () question1 = "What is your last name?" print (question1) answer1 = raw_input () print (answer1 + answer) Thanks!
The two strings, answer1 and answer are "added" together. Do either of them have a space? Probably not. You could also "add" (concatenate) a space between those two strings. print( answer1 + ' ' + answer )
Join our real-time social learning platform and learn together with your friends!