Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

greenbastard Group Title

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)

  • 3 months ago
  • 3 months ago

  • This Question is Open
  1. LanHikari22 Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    hey if you don't mind me asking, what programming language is that?

    • 3 months ago
  2. J.Soto Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    That looks good to me green but I don't think you need to put them in parenthesis. @LanHikari22 This is Python.

    • 3 months ago
  3. e.mccormick Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    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: `print "bla"` In Python 3 and the 2.7.x bridge, the print command was changed to a function and you use" `print ("bla")` 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" a >>> print ("a") a >>> ```

    • 3 months ago
  4. rsmith6559 Group Title
    Best Response
    You've already chosen the best response.
    Medals 2

    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!

    • 2 months ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.