Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 7 Online
OpenStudy (anonymous):

help! for problem set 1, how do i finish writing calculations with out python asking me to set values for raw_input statements which are supposed to be user given? thank you!!

OpenStudy (e.mccormick):

I am not sure what you mean by set vaues.

OpenStudy (anonymous):

Can you post your code for an example? I am not following either.

OpenStudy (anonymous):

for example, x = float(raw_input('enter credit card outstanding balance: ')) once i hit enter i get enter credit card outstanding balance: and if i don't give it a value right then i can't define x or continue writing calculations to get the homework done. i want to know how to be able to write: x = float(raw_input('enter credit card outstanding balance: ')) y = float(raw_input('enter annual credit card interest rate as a decimal: ')) but i can't write the second statement with out having python asking me to actually enter the credit card balance sorry i'm so wordy. i'm still not sure of what i'm doing. but thank you for inquiring!

OpenStudy (e.mccormick):

OH! You are in the interpreter. File new. Then save it and you can run it after it is all typed.

OpenStudy (e.mccormick):

http://www.annedawson.net/Python_Editor_IDLE.htm

OpenStudy (anonymous):

A little advice, give your variables meaningful names. When you are looking at code either to refactor or debug it later, variables like x offer nothing. But, outstanding_creditcard_balance tells you exactly what the value holds.

OpenStudy (e.mccormick):

Yes, very good advice by astonecipher. Only use things like x, y, i, and so on for local loop variables where their use is obvious and limited to the smallest scope. For others, a longer name is better. outstanding_creditcard_balance might be a bit much, but outstanding_CC_bal also works well and can be clear. Shortening it all the way to out_CC_bal might be a little too short to get the point across. So the goal is to make it clear, but not so large that typing it is a chore.

OpenStudy (anonymous):

thank you very much! that definitely helps!! :)

OpenStudy (e.mccormick):

Good! have fun!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!