Python's general Program Basic architecture is: input, processing, output , these three blocks.
Input: Includes two content, variable assignment and input statement
Processing: including arithmetic operations, logical operations, algorithmic processing of these three aspects
Output: Includes printout, write to file, write to database three blocks
Here are two examples to learn more about Python's Basic program architecture
1
Input: Variable Assignment
Processing: arithmetic operations
Output: Print output
x = #变量赋值x =12 y = #变量赋值y =13 z = x + y #算术运算 print (z) #打印输出 25
2
Input: Input statement
Processing: Algorithmic processing (function processing)
Output: Print output
STR1 = raw_input ("Input a string:") #输入语句, Raw--input is a function, his role is to input the keyboard characters, the input results are assigned to STR1, behind () is a hint string, Its role is to enhance the friendliness of the interactive interface input a string: #输入51cto网站 print (STR1) #打印输出
n = Len (str1) #len函数作用查看字符个数, assigns the result to Nprint (n) #使用print查看字符个数13 #51cto网址字符个数13个
This article is from "Zhang Fan-it's fantasy drifting" blog, please be sure to keep this source http://chawan.blog.51cto.com/9179874/1560378
Python Program Basic Architecture