In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how to use if sentence condition judgment in python. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it with the editor.
I. if statement
The translation of the if statement means "if". Statement format in python: follow the module format in python. A module begins with a colon and uses code indentation as the standard for module content.
Give an example of an if statement as a module
If condition judgment:
Code 1 that executes when the condition is True
Second line of code 2
... .
In this line, the current line is aligned with the above if condition and is no longer used as module content.
Use if statement as an example
Xerox 555
If Xerox 555:
Print ("Liu Jinyu programming, programming to create the city")
Note: whether the judgment here is equal or not uses double equals = =
2. Else otherwise
Else statement, which must be used with if.
The format is as follows:
If condition judgment True/False:
The code to be executed when the condition is True
Here is the content of the module when if is true
Else:
Here is the module content that belongs to else, or
It belongs to the module content when if is False.
The independent other code here
It is worth noting that the use of indentation to distinguish module content, you must use strict indentation rules, each module indentation in turn, indentation generally uses the tab key, that is, four spaces. The above is how to use if sentence condition judgment in python. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.