Just wondering if this is a good way to do problem set 0 for the spring course:
x = raw_input('Please enter your birth date: ')
y = raw_input('Please enter your last name: ')
print (x +' ' + y)
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
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.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
hey if you don't mind me asking, what programming language is that?
That looks good to me green but I don't think you need to put them in parenthesis. @LanHikari22 This is Python.
What J.Soto is saying is mostly correct. You are mixing 2.x and 3.x type commands.
`x = raw_input('Please enter your birth date: ')` is a 2.x command for getting input and needs parentisis.
In Python 2, before 2.7.x, the print command was:
In Python 3 and the 2.7.x bridge, the print command was changed to a function and you use"
However, pythin 2.7.x can actually use both:
Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> print "a"
>>> print ("a")
Not the answer you are looking for? Search for more explanations.
FYI, print (x +' ' + y) can also be written: print x, y (Python2 syntax). The comma will give you a space between the variables.
In a simple program like this it's not too important what the variables are named. As programs get bigger and more complex, useful variable names can make reading the code MUCH easier. For instance:
birthDate = raw_input( " Please enter your birth date: " )
Never too early to start good habits!