Python self-study takeoff--try

Source: Internet
Author: User

According to the programming tradition, the first to output a "hello,world!", the process is quite simple, directly on the command and results:

>>> print "hello,world!" hello,world!

In the Baidu Encyclopedia mentioned "..., in foreign countries using Python to do scientific calculation of research institutions are increasing, ...", and then a few of my son to learn the math problems to try:

>>> 10+3 >>> 12+18 30

I verify on the calculator, 10+3=13 is right, 12+16=28 is right, this is how to go!!!


In the actual application should put the input into the file, the use of the time used directly on the line, and will not be like the above is not a memory error or input wrong problem.


Next, print "hello,world!" Deposit hello.py

[email protected] pythontest]# cat >> hello.py <<EOF> print "hello,world!" > Eof[[email protected] pythontest]# lltotal 4-rw-r--r--. 1 root root 6 13:09 hello.py[[email protected] pythontest]# chmod +x hello.py [[email protected] pythontest]# Llto Tal 4-rwxr-xr-x.    1 root root 6 13:09 hello.py[[email protected] pythontest]# python hello.pyhello,world! Add the following to the first line of the Python file and you can execute it directly [[email protected] pythontest]# cat hello.py #!/usr/bin/env pythonprint "hello,world!" [Email protected] pythontest]#/hello.py hello,world!

Python self-study takeoff--try

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.