Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 22 Online
OpenStudy (anonymous):

Problem set #0 For the code x = raw_input ('Name: ') y = raw_input ('Date of Birth: ')Basically i have to write the first line (x) press enter and write the name, then write the second line (y) press enter and write the date. Then print x,y. Is it possible to write both lines press enter and assign both x and y?

OpenStudy (turingtest):

x, y = raw_input("Name: "), raw_input("Date of Birth: ")

OpenStudy (turingtest):

you still have to press enter for each prompt, but that gets it done in one line

OpenStudy (turingtest):

if you are willing to forego the prompts, you can write x, y = 'Fred', 'July 7' and that will assign x to 'Fred' and y to 'July 7', but again, you won't get the prompts

OpenStudy (rsmith6559):

Usually, the Python download has IDLE. IDLE is an IDE (Integrated Development Environment). Fancy term that means a text editor tied into Python and some debugging tools. The upshot is: you could, and with more complex programs will, write your program with the editor and then run your program (in IDLE, I think it's the F5 key).

OpenStudy (anonymous):

Is this an efficient program? or is yours better 'Turing test' print ('Whats your date of birth:') DOB = raw_input('') print ('Enter your last name:') Last = raw_input ('') print (Last, DOB)

OpenStudy (turingtest):

very clever @brb_96

OpenStudy (anonymous):

thanks

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!