In problem set 0, I can't view the final output. This is my code: lname = raw_input('Enter your last name: ') fname = raw_input('Enter your first name: ') print fname print lname I'm looking for something like getch() in C++. Also, is there a newline character that I can use to print my first and last name on 2 separate lines? (Like '\n' in java/c++/)
The print keyword will automatically insert a newline after it prints, however '\n' in a string literal will evaluate the same as it does in C, C++, Java, and numerous other languages.
How are you running your code here?
The print doesn't add a newline when I run it though. I'm running it in windows. I get a terminal window (looks like a dosbox window). And could you tell me why I can't see my output? I know it's running without errors because when I added this line: end=raw_input("End?") I can see my first and last name.
@aq147852 , type your code in a new window again , it will run. it did work for me. here: lname = raw_input('enter your last name: ') fname = raw_input('enter your first name: ') print fname print lname it worked fine.. if there is any more problem do post it.
It runs on the IDLE but doesn't show up on the terminal window..
Once you have the IDLE open, the black dos box thing just sits in the background. You run the program through the window you saved and in runs in the screen called Python Shell. Have a look at this to check your set up is correct. http://screencast.com/t/MTrBO0BfdlSC
Thank you so much Joz! That really helped :)
Join our real-time social learning platform and learn together with your friends!