View Full Version : Learning programs
andyhaus1057
Jul 9, 2009, 07:58 PM
Hi, I'm stumped with this.. Can you please help?
1) What could I expect as output to the program?
studentName = raw_input ('Enter student name. ')
2) What type of value can I expect the user to enter?
creditsDegree = input ('Enter credits required for degree.')
3) Which functions should be used to take in input from the user?
1) studentName
2) creditsDegree
3) creditsLeft
I do know that they are either
a) raw_input
or
b) input ()
Perito
Jul 9, 2009, 08:20 PM
I'm uncertain why you're stumped. It seems very straight-forward. This appears to be the Python programming language. You really need to identify that when you ask questions because there are many programming languages, and they use the same keywords for different things.
raw_input returns a string to the program. It prints the prompt that is shown in parentheses, probably in a message box and returns whatever the user entered.
input returns a "Python Expression". You'll have to figure what that is; no one else has been able to do it. ;)
If you wish to return a string, select "raw_input". A student name would obviously be a string. A number would probably have to use "input", though it's probably possible to get a string and convert it to a number.
I think you can figure out the answers.
Oh, I found this link that might be useful:
Python - input v raw input (http://www.wellho.net/mouth/1461_Python-input-v-raw-input.html)
By the way, put future questions under "Programming".
chuckhole
Jul 13, 2009, 07:18 AM
........You really need to identify that when you ask questions because there are many programming languages, and they use the same keywords for different things............
By the way, put future questions under "Programming".
Totally agree. There are so many scripting languages and an incomplete question can easily result in a wrong or incomplete answer.