I'm stuck on problem set zero (you can start laughing). I can get raw_inputs to be stored in variables, to where I can just type in the variable that I have them into IDLE and be returned with the appropriate string. However, the problem I'm having is getting the code to run in a sequence. For instance, if I do FirstName = raw_input ('Enter Last Name') LastName = raw_input ('Enter First Name') It will query me for my last name and stop. I guess it's sequencing that I'm having issues with. Thanks for any potential help.
do you enter your last name?
I noticed that I kinda flubbed up the variables, but no, it doesn't allow me to enter my last name.
By which I mean first name. I'm confusing myself here.
when this is executed FirstName = raw_input ('Enter Last Name') you should see Enter Last Name do you see it?
Yes. My issue is when I put my (fixed) LastName = raw_input ('Enter Last Name') command with my (also fixed) FirstName = raw_input ('Enter First Name'), it only queries me for my last name.
so click on keyboard something and press enter
Let me copy/paste what's going on in my IDLE screen. >>> x = raw_input ('Enter Last Name') y = raw_input ('Enter First Name') Enter Last Name Test >>>
X being LastName and Y being FirstName.
My first issue is that it is not querying me for my first name after I enter my last name.
well i have never used IDLE but your code is ok :D
I'm using Idle, saved your code and was prompted for first and last.
do you have to save code to a file.py? or you just type code in console?
assuming the answer you put in for last name was "Test"
I'm typing the code in Notepad and copy/pasting it into IDLE, making sure that I don't miss a bit of code. It may very well be that I need to update Python. I'll be back in about 15 minutes after I update it.
If you're using IDLE, in the Python Shell, go to file,and open a new window. use this to write your code and save it as a .py file you have to save in order to run the whole program.
copy pasting may be not good
try to enter each line into IDLE or from notepad you can save to file.py and run it
Bit too late now; I've already started uninstalling Python. But I swear... if it's saving it in a .py file that it was... Oh, those minor details. Will try it after updating Python to 3.
don't update to 3!!!
yeah I'm using 2.7.1 , don't go to 3
python 3 is somewhat different
and im pretty sure mistake was copying/pasteing
*won't go to 3 *will instead download python 2 again Alright.
*sigh* It would be the fact that I'm not saving it in a .py file. Thanks for the help, guys!
its not necessery to save it to file, but you cant copy/paste to IDLE if it asks for more than 1 input
it's always the little things.
try this print (raw_input("Enter the Last Name: ")+"\n"+raw_input("Enter the First Name: "))
The problem could be you're pasting from notepad which uses the windows \r\n characters for line returns which isn't compatible with *nix based systems. Notepad is notorious for this. If you're using windows I would suggest Notepad++ which gives you the option of using unix style newline encoding so you won't run into this issue. It also offers line counts and code highlighting for easy reading.
Join our real-time social learning platform and learn together with your friends!