The first Python program in the python Getting Started Tutorial

Source: Internet
Author: User
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.

 

>>> 900-300 600 >>>

 

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.