Python first day Welcome to Python

Source: Internet
Author: User

I'm still a beginner, and I just started to learn that Python is interested in it because I've seen it before. Eric says it's a very nice person.

Python is elegant and robust, has the power and versatility of traditional languages, and is easy to use. I can't imagine what Python can't do.

Origin: Van Rossum 1989 founder Python,voor is a CWI engineer, released the first version in early 91 because of a project need.

Upgradeable: Scalable. Easy to learn,

Python works mainly in two ways: statements and expressions, statements that use keywords to make up commands, and a command that tells the multifunction interpreter that you tell

What Python does, what it does for you, the statement can have output, or it can have no output,

For example, print ' Hello world! '

Expressions have no keywords, you can use mathematical operators to form arithmetic expressions, you can call functions with parentheses, and you can accept user input. Can not accept user input

Program output: Print statement

>>> mystring = ' hello,world! '
>>> Print mystring
hello,world!
Give a string to mystring to display the variable content with Pring

The use of print and% implements the string substitution function,

>>> print "%s is number%d!"% ("Python", 1)
Python is number 1!

% is replaced by a string,%d is replaced by an integral type,%f is a floating-point replacement, Pring can also redirect output to a file. New from python2.0

This is important.

Program Input Command:

>>> user = Raw_input (' qin ni shu ru ')
Qin ni shu Ruroot
>>> print ' ni shu ru de shi ', user
Ni shu ru de shi Root

Using the Raw_input function, enter the text

Now enter anumber:1024
>>> print ' Doubling your number:%d '% (int (num) * 2)
Doubling your number:2048

You can also enter a string value int (is the value)

#是python的注shi

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.