Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

beginner2011

  • 3 years ago

this was the program i wrote question1="Enter your first name" print(question1) firstname=raw_input() question2="Enter your second name" print(question2) secondname=raw_input() print(firstname) print(secondname) print(firstname,secondname) ... for example if the inputs are ron and hermione then the output is coming like ron hermione ('ron','hermione')..why is the third output coming with paranthesis and quotes.. i didnt understood that one...

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

    print as a function instead of a statement is in py3, are you intentionally using py3? If not I'd switch to py2.7 for now. I'm not too familiar with py3 but changing the last line to: print(firstname + ' ' +secondname) Will get it to print normally

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

    actually try the last line without parentheses and see what that does for you, you may be using py3 syntax on a py2.x interpreter

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

    yeah thank you..Entering the last statement without parenthesis gave the actual output ...I dont know which python version i am using ..I am using ubuntu 10.10 and i am saving the program in a file and executing from the terminal...so which one would i be using?

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

    I'm using ubuntu 10.1 also: python -V also when you start up idle it prints the version at the top.

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

    hmm..its python 2.6.6

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

    well it's python 2.x you'll want to be studying python 2.7 tutorials for now then. I'm finding o'rielly's: 'learning python' and 'programming python' to be quite you might want to see about finding those in a nice pdf( or I could donate them to you) it teaches py2.x/3.0 and notes the differences

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

    Right now i am a beginner in python ..learning through the reading section in MIT course and the lectures..If you have any other links for important materials...It would be useful for me ....I went through all the languages (C,C++,java,Php) in my Bachelors but never learnt one properly and doesnt know to write a good program...thats why i started learning linux so that i may know the logical reasoning of writing programs...thanks in advance

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

    I recommend checking out the Readings section. They link to a PDF there that you should read after each lecture.

  9. 12franklin
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    How do I return while writing? I know it's a beginner question but this is my first day ever trying to program at all.

  10. 12franklin
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    When i say return I mean go to the next line to write script.

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

    Maybe I'm misunderstanding you but you push the enter key.

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

    When I press the enter key it gives me the output For example: print 'Hello' then when I press enter Hello

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

    Are you in python command line? In order to program in script you need run IDLE and python shell. In order to do that, you need to open notepad and then save it as a blank document with the extension .py. After its been saved you right click the document and click edit in IDLE.

  14. 12franklin
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    So I can't write programs just using the Python shell? I write them in a document? How do I run a program that I have written? Sorry about all the questions. I'm still trying to understand the basics.

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

    No I dont think so. I'm learning as well and just started, but i'm pretty sure you can't. Editing in IDLE is a pretty useful way of writing programs at least for me it is

  16. 12franklin
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thank you. So each time I modify I have to go back, save, and then open?

  17. 12franklin
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I just tried that but I don't have notepad so i used pages and it won't let me save as .py. then, I tried copying and pasting onto IDLE but it said I had unsupported characters.

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

    Open IDLE, and then go File -> New Window. That new window is your text editor. Then the original window is a python shell. You do your work in the text editor, then save to file, and run. Then you can interact with it in the python shell window.

  19. 12franklin
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Yay! My first program!

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

    Congrats!

  21. 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.