Python入门第三课

python 复制代码
# 入门第三课
#  关键字 if and or in not in == !=
car = 'g'
print(car == 'g')
print(car == 'dd')
if car != 'hh':
    print("wlcome to here ")
age = 33
print(age == 33)
print(age == 44)
age1 = 44
if age >=0 and age1 >= 0:
    print("nihao")
if age >=0 or age1 >= 0:
    print("hao")
now = ['a','c','d']
print('a' in now)
print('b' in now)
# 布尔表达式 基本和Java和C语言类似的
age = True
age = False
#  if-elif-else 结构
# 在这个结构 else 可以省略
# 中间的 elif 相比较于Java 是不一样的
# 中间的elif可以有多个
if 'aa' in now:
    print("nihao")
elif 'c' in now:
    print("ni")
elif 's' in now:
    print("hao")
# 今天的学习还是很简单的那 类比学习感觉很快的
相关推荐
Eward-an8 小时前
【算法竞赛/大厂面试】盛最多水容器的最大面积解析
python·算法·leetcode·面试·职场和发展
no_work8 小时前
基于python预测含MLP决策树LGBM随机森林XGBoost等
python·决策树·随机森林·cnn
进击的雷神8 小时前
地址语义解析、多语言国家匹配、动态重试机制、混合内容提取——德国FAKUMA展爬虫四大技术难关攻克纪实
爬虫·python
FreakStudio8 小时前
一行命令搞定驱动安装!MicroPython 开发有了自己的 “PyPI”包管理平台!
python·stm32·单片机·嵌入式·arm·电子diy
Barkamin8 小时前
队列的实现(Java)
java·开发语言
hixiong1239 小时前
C# OpenvinoSharp使用RAD进行缺陷检测
开发语言·人工智能·c#·openvino
小浪花a9 小时前
计算机二级python-jieba库
开发语言·python
Storynone9 小时前
【Day23】LeetCode:455. 分发饼干,376. 摆动序列,53. 最大子序和
python·算法·leetcode
骇客野人9 小时前
自己手搓磁盘清理工具(JAVA版)
java·开发语言
清风徐来QCQ9 小时前
Java笔试总结一
java·开发语言