Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

pencils

  • 2 years ago

for problem set 0, i am typing "birthdate = raw_input('Enter your birthdate: ')" and then pressing enter and typing my birthdate and then pressing enter and typing "name = raw_input('Enter your name: ')" and then pressing enter and typing my name and then pressing enter and typing "print(name + birthdate)" in order to complete the assignment. is there a way to write the program all before so that, when run, it asks for birthdate, then the user types it, then it asks for a name, then the user types it, and then it prints out the name and the date?

  • This Question is Open
  1. yak-coder
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    try this and let me know if it works! birthdate = raw_input('Enter your birthdate: ') if str() in birthdate: inputa= birthdate name=raw_input('Please, write your name: ') if str() in name: inputb= name print" Your name is", inputb, " and your birthdate is", inputa, "." since you used raw_input i figured u r running Python 2.x. u might want to experiment with the type handling in the code because in its current state i think it is crash-prone

  2. pencils
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    i think i might be typing this in the wrong spot... in which window am i supposed to type the code? in the IDLE window? i'm a bit confused as a beginner, thanks for your help!

  3. yak-coder
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    if u want to use this piece again click on File>New while on the IDLE window. then type in exactly as u see it. pay close attention to the white spaces(indentations).or copy and paste it. but if you just want the interactive mode where you type in and get response there and then, type the code when you see the >>> prompt. feel free to ask me if anything isn't clear!

  4. pencils
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    thank you so much! it makes sense now, i was typing after the >>> and that was confusing me. you're the best!

  5. yak-coder
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    OK! am glad it worked out well for u!

  6. RichardGoodrich
    • 2 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I did it this way in homework_1.py and it ran fine. I hope that was what was wanted ;-) print ("********** Exercise 1.5 **********") firstName = raw_input('Enter your first name: ') lastName = raw_input('Enter your last name: ') print 'Enter your date of birth: ' month = raw_input('Month? ') day = raw_input('Day? ') year = raw_input('Year? ') print 'Chuck Norris was born on March 10, 1940.'

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

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

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.