Python Study Notes-Day1-Python basics, python-day1-python

Source: Internet
Author: User

Python Study Notes-Day1-Python basics, python-day1-python
1. Translation of advanced languages into machine languages: Interpretation and compilation

Python is an interpreted language.

1.1 syntax common three error types

Syntax error (syntax errors)
Running error (runtime errors)
Semantic Error (semantic errors)

1.3 variables and types
Variable:As the name implies, a variable is a variable value that can be called repeatedly. Improve development efficiency
Variable type (call range ):Global and local variables
Common types of variable values:INTEGER (int), float, str, null)
The variable is relative to the constant: the variable is a fixed amount, such as the circumference rate pi.

1.4 rules defined by variables:

-The variable name can only be any combination of letters, numbers, or underscores.
-The first character of the variable name cannot be a number.
-The following keywords cannot be declared as variable names.

['And', 'as', 'assert ', 'Break', 'class', 'contine', 'def', 'del ', 'elif ', 'else', 'Got t', 'exec ', 'Finally', 'for ', 'from', 'global', 'if', 'import', 'in ', 'Is ', 'lambda', 'not ',' or ', 'pass', 'print', 'raise ', 'Return', 'try', 'while ', 'with', 'yield ']

 

Python2.X and python3.X output comparison

Python2.x output Syntax: print "output content"
Python3.x output Syntax: print ("output content ")

Input comparison between python2.X and python3.X python2:name = raw_input("What is your name?") #only on python 2.x python3:name  =  input ( "What is your name?" )

 

A variable can only start with an underscore or a letter and cannot contain spaces. It cannot contain special numbers,

Variable = variable value (string, integer, floating point, null)
Variable = variable value (= Arithmetic Operator, equal)
Correct: the following code should be displayed to the python Interpreter:

#! /Usr/bin/env python
# Specified Character Set
#-*-Coding: UTF-8 -*-

Python annotation syntax

Single Row gaze: # commented content

Multi-line comment: '''commented content '''

Multi-line comment: "commented content """

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.