anonymous
  • anonymous
Hi everyone - I am doing the first problem set (#0) and I have almost figured it out and got it working but when I run the module it asks the two questions twice before it outputs your name and d.o.b together. Can anyone help?
MIT 6.00 Intro Computer Science (OCW)
katieb
  • katieb
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
actually never mind - i figured it out! But it would be great if someone could have a look at my final source code to see if it is in fact correct or if there is another way you could do it. This is what I ended up with: dob = raw_input('What is your date of birth? ') name = raw_input('What is your last name? ') print(name + dob)
harsimran_hs4
  • harsimran_hs4
this code is absolutely right as you are taking name and dob as strings and then adding them up
anonymous
  • anonymous
is there a space between name and dob? is that what you intended? another way might be; print name, dob

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
An easier to understand version of the space could be a literal concatenation: print name + " " + dob
dkoobs
  • dkoobs
I think your code is right for python 3, but not for version 27. Does it matter which one we use for this course?
rsmith6559
  • rsmith6559
His code is good for v2.x. V3 uses input() instead of raw_input().
anonymous
  • anonymous
Thanks for your input guys! I didn't intend for there to be aspace but I wasn't sure if there needed to be a space either side of the '+' sign but I wil keep your comments in mind for when I do want a space :) Thanks everyone you have been super helpful.
rsmith6559
  • rsmith6559
The space on the side of the plus sign is an optional matter of syntax. When you're concatenating strings, you get exactly what you specify: print "Hello" + "World" # is probably wrong print "Hello " + "World" # is probably right

Looking for something else?

Not the answer you are looking for? Search for more explanations.