首页 > 编程语言 >笨办法学Python3 习题29 if 语句

笨办法学Python3 习题29 if 语句

时间:2023-10-09 12:11:41浏览次数:45  
标签:笨办法 people People 29 cats print world 习题 dogs

 1 people = 20
 2 cats = 30
 3 dogs =15
 4 
 5 if people < cats:
 6     print("Too many cats! The world is doomed!")
 7 
 8 if people > cats:
 9     print("Not many cats! The world is saved!")
10 
11 if people < dogs:
12     print("The world is drooled on!")
13 
14 if people > dogs:
15     print("The world is dry!")
16 
17 dogs+=5
18 
19 if people >=dogs:
20     print("People are greater than or equal to dogs.")
21 
22 if people <=dogs:
23     print("People are less than equal to dogs.")
24 
25 if people == dogs:
26     print("People are dogs.")
PS C:\Users\Administrator\lpthw> python ex29.py
Too many cats! The world is doomed!
The world is dry!
People are greater than or equal to dogs.
People are less than equal to dogs.
People are dogs.

 

标签:笨办法,people,People,29,cats,print,world,习题,dogs
From: https://www.cnblogs.com/luxiaoli/p/17751424.html

相关文章

  • 笨办法学Python3 习题26 恭喜你,现在可以考试了!
    下载代码learnpythonthehardway.org/python3/exercise26.txt进行修改1print("Howoldareyou?",end='')2age=input()3print("Howtallareyou?",end='')4height=input()#没有input()5prin......
  • 算法训练day29 LeetCode 39.40.131
    算法训练day29LeetCode39.40.13139.组合总和题目39.组合总和-力扣(LeetCode)题解代码随想录(programmercarl.com)classSolution{private:vector<vector<int>>result;vector<int>path;voidbacktracking(vector<int>&candidates,......
  • 关于大顶堆和小顶堆习题的解决
    好吧,不得不承认的是,我之前对于堆的知识确实没理解,现在急用它,就急学!一般的习题的话,就是要求我们判断某个序列,是不是大顶堆或者小顶堆。小顶堆要求,k(i)≤k(2i)且k(i)≤k(2i+1)大顶堆要求,k(i)≥k(2i)且k(i)≥k(2i+1)就只需要这两个条件就能判断顶堆是否成立啦~~......
  • python29days
    绑定方法绑定给对象绑定给类非绑定方法(静态static)封装隐藏属性property装饰器(内置的,用来把函数伪装成属性)封装————————————————————————————————————————————————————————  该方法就......
  • 记一次某大型会议官网任意密码重置漏洞挖掘(CNVD-2023-41929)
    记录一次本人CNVD漏洞挖掘的过程,此漏洞已被分配编号:CNVD-2023-41929引言本文记录了一次对某大型会议官网任意密码重置漏洞的挖掘,漏洞挖掘时该会议处于即将召开的状态,参会人员来自国际和国内。漏洞挖掘通过信息收集和测试发现存在一个管理后台,且有重置密码接口,但需要一个nonce......
  • 建表,和练习题
    目录建库注意::整形和浮点型不用加''号,其他字符串型那部分需要加''表一联合主键001建表练习题查询练习sql练习建库createdatabaselinux注意::整形和浮点型不用加''号,其他字符串型那部分需要加''表一字段数据类型要求是否为空注释sno最多20位否学号(主键)sn......
  • 习题专题
    习题3:在有序的元组中查找元素方法一:利用遍历元组来查找#include<stdio.h>//遍历的方法查找元素intmain(){ intr=0;//为查找的数初始化 printf("请输入要查找的数字:");scanf("%d",&r);//输入要查找的数字 intnumber=r; inti=0; chararr1[]={1,2,3,4,5......
  • 习题专题
    习题4:演示多个字符从两端移动中间汇聚#include<stdio.h>#include<string.h>#include<windows.h>#include<stdlib.h>intmain(){ intsl=strlen("welcomebit!!!!!!");//strlen()遇到\0会停止!!! chararr1[]="welcomebit!!!!!!"; cha......
  • 295. 数据流的中位数
    中位数是有序整数列表中的中间值。如果列表的大小是偶数,则没有中间值,中位数是两个中间值的平均值。例如arr=[2,3,4]的中位数是3。例如arr=[2,3]的中位数是(2+3)/2=2.5。实现MedianFinder类:MedianFinder()初始化MedianFinder对象。voidaddNum(intnu......
  • oj练习题 数字 eval 整数 int ???
      s=input()if'helloworld!'==s.casefold():print("Yes")else:print("No")    A+B问题II描述亲爱的小朋友们,大家好!今天我们来探讨一下大家都会做的A+B的问题,给你两个数A和B,请你输出这两个数的和。输入输入两个数字,a和b输出输出一个......