Re-learn Python, learn python

Source: Internet
Author: User

Re-learn Python, learn python

Digress:

Python version: Latest 3.6

Installation Note: select the Add path to customize the first-level directory for installation to the hard disk, for example, my installation path: F: \ Python

Cause: You can automatically add python environment variables and associate them automatically. py file, there are many other advantages, such as learning selenium, using pip install selenium command can install selenium 3, although python webdriver automation is still 2.7, but 3.0 will be in the future

 

I will talk about things in other words. Now I have officially started to learn Python. I can't do it. I can't do programming tests, but I can't learn python. I don't play dota2 !!

 

The conventional first python Applet

 

1 >>> print ("I can't learn python. I don't play dota2 !! ") 2 can't learn python, don't play dota2 !! 3 >>> print ("Hello Python! ") 4 Hello Python!

PS: the python-running compiler comes from the python installation package's IDLE

 

Variable

 

1. What you see is what you get. Everything is an object. An example is as follows:

>>> x = 7>>> y = 8>>> z = x * y>>> a = 3.14>>> b = "python">>> c = x * b>>> print("z = ",z)z =  56>>> print(c)pythonpythonpythonpythonpythonpythonpython>>> print(z*a)

Variable: In my vulgar sense, the variable name is the mark of the data in the memory. When we call the variable name, we use the variable name to specify which data in the memory is used by the program.

>>> a =7>>> id(a)497050016>>> a = 9>>> id(9)497050080

Id () is a python built-in function that views the location of data in the memory. a is a variable, marking and storing data. When a is called during running, the program knows the data marked in memory by.

2. variable name command rule definition:

>>> Student_tel = 138 # underline Separation

 

User input

 

Input: all received data is forcibly processed as strings.

user_name = input("pls input your name:")user_age = input("pls input your age:")default_age = 100last_age = default_age - int(user_age)print(type(last_age))print("%s has the last %d yesrs"%(user_name,last_age))

The above Code involves the concept of formatting output.

 

Related Article

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.