Wednesday, February 17, 2016

Create/Save/Run Python ScriptFiles

1) Type your python script in a notepad.
2) Save the notepad as "Save as">>All file. Name teh file with the .py extension
3)Now close and open the file using the IDLE IDE
4) Select the "Options" option from the file and "Run Module" to execute the file. 
The execution will open in a new IDLE window with the output.

More Examples:

However, We could also execute this program bu just Double Clicking on the file .
However, once you enter the user name and press " Enter". The program crashes. 

In order to retain the execution window even after the code execution, You could add in another line of code to request the user to press Enter...

input("Press<Enter>")


Inbuilt/UserInput Variables- Python and Modules/Functions



Modules: Functions such as : abs, pow are default and dont need a library being imported.However, functions such as : floor, sqrt, etc needs the math library to be imported.Functions such as : abs, pow are default and dont need a library being imported.However, functions such as : floor, sqrt, etc needs the math library to be imported.




Installing & First program - Python

Reference Youtube Links :
https://www.youtube.com/watch?v=4Mf0h3HphEA&list=PLEA1FEF17E1E5C0DA

1) browse www.python.org >> download
  >>Download Windows x86-64 MSI installer
2) Download and install this file
3) test the correct installation by looking for python on "Start Up >> Programs>>Python" from you system
4) Now, from teh list of options in the "Python" menu.. oPEN on Python interface, IDLE.This will open the Python console.
You will see,

IDLE
>>>>

Now, you first set of code lines to print " Hello World!" needs to be typed as below. and Enter to see the message :)

IDLE
>>>>print ("Hello , World!")


Examples with numbers