首页 > 其他分享 >Day 16

Day 16

时间:2022-11-17 21:14:32浏览次数:34  
标签:apple 16 food str2 str1 item print Day

 

 4-13

food = ('apple', 'meat', 'fish', 'icecream', 'cake')
for item in food:
    print(item)
food = ('pineapple', 'meat', 'fish', 'ice', 'cake')
for item in food:
    print(item)

 

 

 5-1

food = 'apple'
print("Is food == 'apple'?I guess True.")
print(food == 'apple')
print("Is food == 'pineapple'?I guess False.")
print(food == 'pineapple')

 

 

 5-2

str1 = 'apple'
str2 = 'pineapple'
str3 = 'apple'
print("Is str1 == str2?")
print(str1 == str2)
print("Is str1 == str3?")
print(str1 == str3)

str1 = 'HELLO'
str2 = 'hello'
print("Is str1 == str2?")
print(str1.lower() == str2)

print('1 == 1')
print(1 == 1)
print('1 != 1')
print(1 != 1)
print('1 > 2')
print(1 > 2)
print('1 < 2')
print(1 < 2)
print('1 >= 2')
print(1 >= 2)
print('1 <= 2')
print(1 <= 2)

if (1 == 1) and (2 > 1):
    print('hello')
if (1 != 1) or (2 < 1):
    print('no')
if (1 != 1) or (2 > 1):
    print('yes')

food = ['apple', 'banana', 'coconut']
if 'apple' in food:
    print('in')
if 'chocolate' not in food:
    print('not in')

 

标签:apple,16,food,str2,str1,item,print,Day
From: https://www.cnblogs.com/IslandNeo/p/16900939.html

相关文章

  • 百题_每日一题Day11
    打印所有的水仙花数。例如:1^3+5^3+3^3=1531.字符串取数:ifint(i)==int(str(i)[0])**3+int(str(i)[1])**3+int(str(i)[2])**3:--这里利用字符串取数,规避整数位数......
  • CF1648D 简单清楚的做法
    CF1648D简单清楚的做法我自己做这题没做出来,看网上题解都有点难看懂,自己搞一个前置知识线段树维护:对于两个序列\(a,b\),给定\(l,r\),询问:\(\max(a_i+b_j),l\lei\le......
  • 进入python的世界_day33_网络编程—— 黏包现象、UDP协议、并发编程理论
    一、黏包现象1.何为黏包​ 流逝协议:所有的数据类似于水流连接在一起的​ 数据量很小并且时间间隔很多那么就会自动组织到一起recv​ 我们不知道即将要接收的......
  • 【LuoguP5163】WD与地图
    【LuoguP5163】WD与地图Description有一个\(n\)个点\(m\)条边的有向图每个点有点权\(a_i\)维护三种操作:1.删去\(a\)到\(b\)的边2.\(a_i\)加上\(b\)3.查询\(a\)所在......
  • Day14.3:数组的三种初始化理解
    数组的三种初始化静态初始化即数组的声明和赋值一起完成int[]arrays={1,2,3,4,5};动态初始化-——手动赋值(包含默认初始化)声明数组的但不赋以确切的值,没有赋值......
  • day34 JSTL标签
    JSTL标签<!--写在jsp文件的最前--><!--JSTL标签库是一个JSP标签的集合,封装了许多jsp应用程序通用的核心功能prefix="c"标签库的别名是c--><%@tagliburi="http://......
  • day36.黏包现象
    TCP.UDP大致回顾TCP 可靠协议 三次握手建立连接 1.洪水攻击 2.消息反馈 四次挥手断开连接 1.time_wait UDP 不可靠协议"""TCP类似于打电话双方连接......
  • 力扣 160 相交链表
    题目:给你两个单链表的头节点 headA和headB,请你找出并返回两个单链表相交的起始节点。如果两个链表不存在相交节点,返回null。题目数据保证整个链式结构中不存在环......
  • Day14.2:数组的声明及创建
    数组概念相同类型的数据的集合。语法格式://数组类型数组名=数组的值;int[]a=newint[10];//数组a含10个int类型的数据//====================================......
  • 百题_每日一题Day10
    暂停一秒输出。1.导入库、调用函数:'''导入函数'''importtime'''调用函数'''time.sleep(1)2.题解:'''导入'''importtime'''初始化'''s='博主不得更点项目咯......