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
you work with windows or in lunix ?!!!!
window
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
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
wich problem you want to solve if may i know ?!!!!
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
i want to see the even or odd acording the result of x
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
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
so when we can have the test ?
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
perfectelly !!! so befor that steps are more simple try it if nothing happned i will help you more :)
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
no no please tell me you said you have problem you didn't know how to run the programme right ?
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
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
the result is nothing.. only when i press x and enter display the 15 but not if is even or odd?
ok let me see ok ?
here is a print screen
ahhhhhh now i know what are you talking about
look it's too too simple when you typ x so python think that you want to show the value of x
and that's why it prin 15
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).
that is the version i have
and the reason of 15 no idea.. acording to the professor the value of x keep save on the system
the syntax its clear mathieu
whne you type x puthn will understand that you want to show the value of x and that's why showed 15
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
beside that your programme will have an exception if x will = 0 because 0/x will get and an exceptin runtim exception
juan your program is wrong totaly
Join our real-time social learning platform and learn together with your friends!