Working on problem set 0. Code works fine, but runs each command twice. Code - print ('Enter your last name') question2 = raw_input ('Enter your last name') print ('Enter your first name') question1 = ('Enter your first name') print question1 + question2 Output - Enter your last name Enter your last name jones Enter your first name Enter your first name smith smith jones It works, but why twice? Thank you.
Got it - see below. question1 = raw_input('last name') question2 = raw_input('first name') print question2 + question1
Or for a space between: print question2 + " " + question2
Well, 2 then 1... but the " " adds the space.
or just ``` print question2, question1 ```
Make sure you read the readings for the course and practice the examples.
Or read the reading and practice the practicals.... =P If you don't have the course book, there is an open alternative that is a pretty good substitute.
Thank you all. Working on the readings and do have alternative books.
Just question. Do you guys think it's alright if I used xs and ys instead of question1 and question2? Here's what it all looks like. >>>x=raw_input('Enter your date of birth:') Enter your date of birth: 01/01/01 >>>y=raw_input('Enter your last name:') Enter your last name: Smith >>>print y, x Smith 01/01/01 Is this when they were looking for or am I completely off?
You can name your variables whatever you want. You might want to get in the habit of giving your variables meaningful names - it will make your code easier to read.
Okay! Thank you so much! You're great help!
Join our real-time social learning platform and learn together with your friends!