In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about how to use relational operators 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.
Code implementation
Result = 10 > 20 # Falseprint ('result1 =', result) result = 30 > 20 # Trueprint ('result2 =', result) result = 30
< 20 # Falseprint('result3 =',result)result = 10 >= 10 # Trueprint ('result4 =', result) result = 2 > True # Trueprint ('result5 =', result) result ='2' >'1' # Trueprint ('result6 =', result) result ='2' > '11' # Trueprint (' result7 =', result) result ='a' >'b' # Falseprint ('result8 =', result) result ='c'
< 'd' # Trueprint('result9 =',result)result = 'ab' >'b' # Falseprint ('result10 =', result) result = 1 = = 1 # Trueprint ('result11 =', result) result = 'hello' = =' hello' # Trueprint ('result12 =', result) result = 'abc' = =' bcd' # Falseprint ('result13 =', result) result = 'abc'! =' bcd' # Trueprint ('result14 =', result) result = 1 = True # Trueprint ('result15 =', result)
Code run output:
Result1 = False
Result2 = True
Result3 = False
Result4 = True
Result5 = True
Result6 = True
Result7 = True
Result8 = False
Result9 = True
Result10 = False
Result11 = True
Result12 = True
Result13 = False
Result14 = True
Result15 = True
Program analysis
# relational operator
The # relational operator is used to compare the relationship between two values and always returns a Boolean value
# return True if the relationship is established, False otherwise
# > compare whether the value on the left is greater than that on the right
# > = compare whether the value on the left is greater than or equal to the value on the right
# < compare whether the value on the left is less than that on the right
# 0062
The above is how to use relational operators in Python, and 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.