In the last example of sharing Python, we shared how to install Python applications in a Windows 64-bit environment. We will continue to share with you today, how to compile my first Python program.
1. Write the first program through IDLE (Python GUI)
Open-Start-> program-> python-> IDLE (Python GUI)-> to view the following interface,
Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32 Type "copyright", "credits" or "license () "for more information. >>>
Enter a number and calculate the result.
Soon the results came out, and we were not allowed to write too much code.
The preceding example shows how to Print some text for the calculation of a number. "Here we use ''print"
>>> Print 'Hello, world' Hello, world >>>
Such a simple 'Helo, world' is printed out,
2. How can I use command line operations?
We still use the above example:
Start-run-cmd open the command prompt window and enter Python. The prerequisite is that we need to write our environment variables in advance, and the previous installation process has been completed. If you do not understand, please refer to the previous installation process.
C: \ Users \ Key Jia> python Python 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright ", "credits" or "license" for more information. >>>
Enter a number and calculate the result.
>>> 300 + 870 1170 >>>
Use the Print function to Print 'Hello, world'
>>> Print 'Hello, world' Hello, world >>>
The same effect can be applied in two different methods.
3. How to exit
>>> Exit () C: \ Users \ Key Jia>
Through the above operations, I believe that you have gained a strong interest in Python. I will share with you the following content and make progress.