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

Ok, working with the very first problem set, and I don't understand how you create a script... I tried opening a new window from IDLE, writing print type(3) saving and executing, but in the shell it just says restart. help?

OpenStudy (anonymous):

What did you print?

OpenStudy (anonymous):

well, as you understand i'm completely new to all of this, but i really want to learn. what i don't understand is the very most basic thing: WHERE do you write scripts? (in the video he just opens a script that he has...) i can print in IDLE, but how do i create programs/scripts that run there? (like the teacher does in the second video)

OpenStudy (anonymous):

open the IDlE press ctrl+N to open a new window where u can type ur code and to run it press F5 on that window. Ur code will then be compiled.

OpenStudy (anonymous):

hey thanks! that's exactly what i did (i thought...) but now it works... sort of. i write print raw_input('what is your name ') x = raw_input('what is your name') print ('your name is' + x) and i get what is your name martin martin what is your name martin your name is martin why does it ask twice? thx alot, this is my first script :D

OpenStudy (anonymous):

Because u asked raw_input twice.

OpenStudy (anonymous):

but isn't the second just defining x? how should i do it differently?

OpenStudy (anonymous):

print raw_input('what is your name ') and x = raw_input('what is your name') print x Both the above codes prints the same thing

OpenStudy (anonymous):

cool thanks! now it's x = raw_input('what is your name? ') print ('Aha, your name is ' + x + '!') so when i define x as the user's answer to "what is your name?", i also tell IDLE to ask "what is your name?"? it seems a bit too concise... i mean, where does it get the information to pose the question in the first place?

OpenStudy (anonymous):

The Python documentation is your friend. It was installed on your computer when you installed Python. It can be accessed with F1 while in IDLE. The index is an excellent way to find what you are looking for. I find the documentation installed on the computer is easier to use than the online version. You should read the Tutorial in the documentation. When you wonder exactly how a built-in function works, you can usually find the answer in the documentation. The Idle shell is a great place to play around with functions/statements/stuff to see how they work - http://dpaste.com/764925/ The raw_input() function will prompt the user (if a prompt is included) whether you assign the result to a variable or not http://docs.python.org/library/functions.html#raw_input http://docs.python.org/library/functions.html when posing questions on code you have written, please use a code pasting site and post the link with your question. It makes it easier for everyone. http://dpaste.com http://pastebin.com http://codepad.org

OpenStudy (anonymous):

@bwCA thanks! that really helps me understand the logic of the language, and not just the handicraft- from homo faber to homo sapiens in a few easy steps:)

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!