In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "what is the organizational structure of the python program", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what is the organizational structure of the python program" this article?
The organizational structure of the program
Sequential structure
The program executes the code from top to bottom without any judgment or jump until the end of the program.
The Boolean value of the object
Everything in Python is an object, and all objects have a Boolean value
Use the built-in function bool () to get the Boolean value of the object
You can judge the Boolean value of the object directly in the conditional expression.
The Boolean value of the following object is False
False
Numeric value 0
None
Empty string
Empty list
Empty tuple
Empty dictionary
Empty set
The Boolean values of the above objects are False. All other object Boolean values are True.
Select structure
The program selectively executes part of the code according to the Boolean value of the judgment condition.
Clearly let the computer know under what conditions and what to do
Single branch structure
Chinese semantic: if. Just...
Grammatical structure:
If conditional expression: conditional executor
Small experiment money=1000 # balance s=int (input ('Please enter the withdrawal amount') # withdrawal amount # determine whether the balance is sufficient if money > = s: money=money-s print ('withdrawal successful, balance:', money)
Double branch structure
Chinese semantics
If. Not satisfied. Just.
Grammatical structure
If conditional expression: conditional executor 1 else: conditional executor 2
Small experiment num = int (input ('please enter an integer')) # conditional judgment if num%2==0: print (num,' is even') else: print (num,' is odd')
Multi-branch structure
Chinese semantics:
Is the score above 90? No
Is the score between 80 and 90? No
Is the score between 70 and 80? No
Is the score between 60 and 70? No
Is the score below 69? Yes
Grammatical structure:
If conditional expression: conditional executor
Small experiment money=1000 # balance s=int (input ('Please enter the withdrawal amount') # withdrawal amount # determine whether the balance is sufficient if money > = s: money=money-s print ('withdrawal successful, balance:', money)
The unique way of writing python code
Python code can be written mathematically.
If 90
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.