当前位置:网站首页>实例046:打破循环
实例046:打破循环
2022-08-10 02:01:00 【懒笑翻】
题目:求输入数字的平方,如果平方运算后小于 50 则退出。
程序分析:无
实例046:打破循环break和continue用法
一、代码
while True:
try:
n = float(input('输入一个数字:'))
except:
print('输入错误')
continue
dn = n ** 2
print('其平方为:', dn)
if dn < 50:
print('平方小于50,退出')
break
二、运行结果

↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓懒笑翻诚邀您点击下方一起来学习讨论↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
边栏推荐
- 2022.8.9考试游记总结
- Under pressure, there must be cowards
- .Net interview experience summary
- 华为HCIE云计算之FC添加ipsan数据存储
- In automated testing, test data is separated from scripts and parameterized methods
- 2022年8月1日-8月7日(本周10小时,合计1422小时,剩余8578小时)
- The 25th day of the special assault version of the sword offer
- 小菜鸟河北联通上岗培训随笔
- [Syntax sugar] About the mapping of category strings to category numeric ids
- Maya制作赛博朋克机器人模型
猜你喜欢
随机推荐
2020.11.22 Exam Goldbach Conjecture Solution
LeetCode每日两题01:移动零 (均1200道)方法:双指针
[Swoole Series 3.5] Process Pool and Process Manager
2022.8.8 Exam questions for photographer Lao Ma (photographer)
OpenCV图像处理学习二,图像掩膜处理
51单片机驱动HMI串口屏,串口屏的下载方式
openpose脚部标注问题梳理
2022.8.8考试摄像师老马(photographer)题解
【二叉树-中等】508. 出现次数最多的子树元素和
[语法糖] 关于类别字符串到类别数字id的映射
C# 单例模式
Screen 拆分屏幕
storage of data in memory
UXDB现在支持函数索引吗?
数据在内存中的存储
Arcgis进阶篇(1)——安装Arcgis Enterprise,创建sde库
程序员的专属浪漫——用3D Engine 5分钟实现烟花绽放效果
ECCV 2022 Oral | CCPL: 一种通用的关联性保留损失函数实现通用风格迁移
Process management and task management
Open3D 中点细分(网格细分)









