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

hello I am new in this web site and need help on how to run a code line that is in a program in phython? Please some body could tell me

OpenStudy (anonymous):

you work with windows or in lunix ?!!!!

OpenStudy (anonymous):

window

OpenStudy (anonymous):

ok simple you can download a python from the officiel website and stup it after that open his IDE and type your cod and run it or press f5 and it will compile your programme and gived you the result

OpenStudy (anonymous):

if you use lunix it's more simple you don't need stup python on ubuntu for exempe you have alreaddy you just need to type in terminal " python" and after you need write your program and just when you press r your program will run automatically

OpenStudy (anonymous):

wich problem you want to solve if may i know ?!!!!

OpenStudy (anonymous):

ok the thing is that i hava this code x = 15 if (x/2) * 2 == x: print 'Even' else: print 'Odd' in a diferent file and i want to run it and test it as the teacher those in the video, but i don't have clue how to doit

OpenStudy (anonymous):

i want to see the even or odd acording the result of x

OpenStudy (anonymous):

ah it's a simple code to defined if the number is odd or even i think it's simple just flow what did i have said about rning programm and you will be ok

OpenStudy (anonymous):

it's a good exemple to start and you can also have others exemple like you can try to solve fibonacci problem in python or else step by step you will be ok

OpenStudy (anonymous):

so when we can have the test ?

OpenStudy (anonymous):

The test is when the program runs and calcualtes the value of x. Then te result displays even or odd depending on the value of x

OpenStudy (anonymous):

perfectelly !!! so befor that steps are more simple try it if nothing happned i will help you more :)

OpenStudy (anonymous):

I don't think I make my self clear with you. for that reason you don't answer what i need. No worry thank you

OpenStudy (anonymous):

no no please tell me you said you have problem you didn't know how to run the programme right ?

OpenStudy (anonymous):

yes.ok i have python install in my pc (windows). Also I have the program written in an independent file (test.py). what i want to see is the program run and display the result

OpenStudy (anonymous):

ok so run it simepli or copy and past it in the IDE of Python and when you press enter key you will have your result

OpenStudy (anonymous):

the result is nothing.. only when i press x and enter display the 15 but not if is even or odd?

OpenStudy (anonymous):

ok let me see ok ?

OpenStudy (anonymous):

here is a print screen

OpenStudy (anonymous):

ahhhhhh now i know what are you talking about

OpenStudy (anonymous):

look it's too too simple when you typ x so python think that you want to show the value of x

OpenStudy (anonymous):

and that's why it prin 15

OpenStudy (anonymous):

If you want to work on the Intro Course, you should probably install an earlier version of Python (you installed the 3.2.2, and the syntax is quite different).

OpenStudy (anonymous):

that is the version i have

OpenStudy (anonymous):

and the reason of 15 no idea.. acording to the professor the value of x keep save on the system

OpenStudy (anonymous):

the syntax its clear mathieu

OpenStudy (anonymous):

whne you type x puthn will understand that you want to show the value of x and that's why showed 15

OpenStudy (anonymous):

try to define a simple function that has a parameter and called it with defined an empty x and whne that will have your result

OpenStudy (anonymous):

beside that your programme will have an exception if x will = 0 because 0/x will get and an exceptin runtim exception

OpenStudy (anonymous):

juan your program is wrong totaly

OpenStudy (anonymous):

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!