A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

Assignment 1 >>> request = ('Enter your last name: ') >>> response = raw_input() Fast >>> request2 = ('Enter your first name: ') >>> response2 = raw_input() Todd >>> print (response2 + response) ToddFast >>> Did I do this correctly?

  • This Question is Closed
  1. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Sorry, that's Problem Set 0...

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

    Looks like the right idea and it obviously worked. I might be reading your question wrong but have you typed all this into the *Python Shell* window? If you do File --> new window then type: request = 'Enter your last name: ' response = raw_input(request) request2 = 'Enter your first name: ' response2=raw_input(request2) print(resopnse2 + response) Then press F5 or go to Run --> Run Module (it will ask you to save the program as something.py before it can be run)

  3. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Correct the typo in my last line first obviously.

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

    A slight nitpick - the calls to request and request2 are unnecessary. You can pare down the code to simply, reqfirst=raw_input('Enter your first name ') reqlast=raw_input('Enter your last name ') print reqfirst+' '+reqlast (Note: If you don't care about the space at between the first and last name in the printline you can just put print reqfirst+reqlast.

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

    Thanks for the help. I've been using IDLE to type my program in but I'm a little unclear on how to run it. I suppose I missed something. Do I run the program in IDLE?

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

    First you open IDLE (I assume you have that part down). Now, what you just opened is the terminal (I think it's called - I'm new too!), and you can input basic commands there and get your answer. But to program something more you have to open a new window, which you can get by clicking file. The new window (which looks like an empty notepad window) is where you type in the program. Type it in, hit F5, it'll ask you to save so save, and then it'll run the program in the terminal.

  7. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    So I don't type the program in the shell, I type it in the new window? Lol, I'm a little lost.

  8. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Correct.

  9. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    What was I doing by typing it into the shell and not the window?

  10. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You were executing commands, but only one at a time. If you want to run an entire program at one time, you have to type it into the window. Say if I typed the above program into the window. Every time I wanted to do it, I'd have to write, firstreq=raw_input('What is your name? '), whereas if I had it saved in the window and executed the program, it would already have that line going through the shell.

  11. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    are you in chat?

  12. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I just typed this into the new window: firstrequest = ('Enter your last name: ') firstresponse = raw_input() secondrequest = ('Enter your first name: ') secondresponse = raw_input() print (secondresponse + firstresponse) I saved it than ran it but nothing happened in the shell. It just returned a restart with >>>

  13. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    You're not printing the firstrequest/secondrequest. See, you have firstrequest and secondrequest defined, but you're never calling them, and the raw_input has no string. So when you run the program, it's seeing that there's something called firstrequest and processes that, but isn't told to do anything with it, so it progresses onto firstresponse. Since there's nothing in firstresponse other than the raw_input command, you get the ability to input, but there's no prompt to do so.

  14. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    That's why you're only getting >>>. Also, like I said before, you can just put the firstrequest into the raw_input, like: firstresponse = raw_input('Enter your last name ') It'll still let you input, but this time you'll get a prompt to do so.

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

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.