Python Foundation Day1

Source: Internet
Author: User

1) Python developed by Guido

2) compile (compile) type: Generate an executable file directly from the compiler using the code.

For example, to translate English books into Chinese books at once. Languages are: c,c++, etc.

Interpreted: Side-compilation side execution. Language such as: Java,python, etc.

3) dynamic type language refers to the language in which data type checking is done during run time, such as Python,ruby

The static type language is checked during compilation. For example: C + +.

4) Strongly typed definition language: A variable is assigned a data type and is always this type if it is not cast.

Weak type definition language: A language in which data types can be ignored. You can give values of different data types.

5) Python can do network applications, scientific operations, GUI programs, system management tools, etc.

6) Python runs slowly, code cannot be encrypted, and threads cannot take advantage of multiple CPUs.

7) PyPy can provide Python execution speed. The most used is CPython.

8) #! /usr/bin/env python

Print ("Hello World")

Program names end With. py

The first line declares the type of resolution used

9) Guess the Age applet

  

#-*-Coding:utf-8-*-__author__ = ' Shisanjun ' right_age_num=33user_guess_num=int (input ("Please input your guess num") If Right_age_num==user_guess_num:    print ("Congratulations,your guess was right Shisanjun is", user_guess_num) Else:    print ("Wrong anwser,try it agin!")

Interactive input:p Raw_input,python3 input in Ython2

Python2 the input function, enter what type of value is what. Suggest no input in Pyhton2

The input function in Python3 is the value is a string.

10) Data type

There are only int types in integer python3, and Int,long types in Python. Python3 is automatically converted when the data is very long.

Floating point number: is also a decimal, can be rounded.

String: Is any text enclosed in "or". \ is an escape character. \ nthe line, \ t tab. \ \ represents \. "' ... ' can format multiple lines

Boolean type: True,false

Null value: None

11) Variables and constants

A variable can only consist of letters, numbers, underscores, and the first must be letters and underscores. is case sensitive. You cannot use a system function name with the same keyword and class name.

Python suggested name. Like Check_current_conn_count. is to use the underscore to separate

Common variable recommendations are uppercase letters such as pi=3.14

Name= "Shisanjun"

Name2=name

The value of name2 has been modified, and the name value has been modified because the variable is pointing to the same address within.

Python Foundation Day1

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.