Python Getting Started syntax

Source: Internet
Author: User

Programming languages: Machine language, assembly language, advanced languages

According to the conversion mode is divided into compiled and interpreted type. Python-interpreted.

Compiled type

Advantages: The program source code "translated" into a machine instruction, and saved as a binary file, can be run directly on the machine, faster than the interpretation of the type.

Cons: Debugging trouble.

Explanatory type

Advantages: Easy to debug the program

Cons: Inefficient, and cannot generate executable files that can be executed independently, the application cannot detach itself from its interpreter. Only in the execution of the program, only one interpretation of the machine language to the computer to execute, so the speed is not as fast as the compiled program to run.

Java code is called a compilation run everywhere, because the Java agent needs to compile into bytecode (an intermediate format of code), and then take the bytecode run everywhere, each run needs to be handed to the JVM to compile machine instructions to execute, so Java is a mixed type

1. The first thing to know is that the PYc bytecode file is generated only when import is imported into the Py file, which can be executed directly in place of the source file.

2. But each time the py file is executed, the resulting bytecode is not preserved, that is, each time the py file is executed, it is to be re-experienced again: Py file--byte code-->python interpreter--machine code, each time is a re-interpretation of the execution of the process.

File header

#!/usr/bin/env python

# -*- coding: utf-8 -*-Comments

When the line stares: # is annotated content

Multiline Comment: "" "Annotated Content" ""

Python memory management mechanism: https://neo1218.github.io/pymemory/

Input/Output

Import Getpass
n=0
name1= ' Yuyang '
passwd1= ' 123 '
While n<3:
name_=input (' Please input your username: ')
passwd_=getpass.getpass (' Please input your password: ')


if name_ = = name1 and passwd_ ==passwd1:
Break
elif N = = 2:
n=n+1
Continue

Else:
print (' Try Again ')
n=n+1

if n = = 3:
print (' Login failed ')
Else:
print (' Login successfully ')

Operation symbols

Python Getting Started syntax

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.