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")
# 今天的学习还是很简单的那 类比学习感觉很快的
相关推荐
阿里嘎多学长2 小时前
2026-02-16 GitHub 热点项目精选
开发语言·程序员·github·代码托管
啊吧怪不啊吧4 小时前
C++之基于正倒排索引的Boost搜索引擎项目usuallytool部分代码及详解
开发语言·c++·搜索引擎·项目
CeshirenTester4 小时前
9B 上端侧:多模态实时对话,难点其实在“流”
开发语言·人工智能·python·prompt·测试用例
Starry_hello world4 小时前
Python (2)
python
发现你走远了4 小时前
Windows 下手动安装java JDK 21 并配置环境变量(详细记录)
java·开发语言·windows
ID_180079054734 小时前
Python爬取京东商品库存数据与价格监控
jvm·python·oracle
游乐码5 小时前
c#类和对象
开发语言·c#
黎雁·泠崖5 小时前
Java常用类核心详解(一):Math 类超细讲解
java·开发语言
懒惰成性的6 小时前
12.Java的异常
java·开发语言
-To be number.wan6 小时前
Python数据分析:时间序列数据分析
开发语言·python·数据分析