Prepare and run your code

The next step is to prepare your program code for execution. To do this, select File ^ Save from the menu to save your program code to a file. Choose an appropriate name for your program.

+*»» the me„Uj you ¿a* save yw ¿ode i» a -file.

PytU py-cg^ +«enames usually

PytU py-cg^ +«enames usually

Python programs are usually saved in files that end with . py, so let's call this program game . py.

It doesn't really matter to IDLE which directory you save the file in. Some coders like to create special directories for each new programming project. But for now, just save the code in some directory that's easy to remember.

Clidk the Save butt™ to oeate a*cl save the -file.

Now, let's see what happens when we run the program.

m

gama.py -

.'DocjmarTE/qame.py + -

? 1

TiIp rrtit Tnrmat

111 in Ojitinri«!

W/inrinws

jjpip |

print("Wclcorc J y «= inpu L ( " G-jta guooa - int(g)

. J yutfssi —= 5 :

Python bihclh

Ir> the IPL-E edit Wmdo*, Ojo to tKe "Rw>" a»d dKoose wRw< Module."

Chtdtfc Hudulhi

AllrX

Drint("ion

Kun Module

" i

piint("ro u Loaoi")

y

FlCofc

r>

Was this article helpful?

0 0

Post a comment