当前位置:网站首页>计算矩形面积
计算矩形面积
2022-06-29 02:12:00 【长街395】
描述
用户输入矩形的长和宽,计算其面积并输出。
a = eval(input()) #输入整数字符串,转换为整数;输入浮点数字符串,转换为浮点数
b = float(input()) #输入整数和浮点数,都转换为浮点数
c = int(input()) #只接受整数输入,输出为整数
#eval()和float()函数都可以把input() 函数接收到的数值型字符串转为数值类型
#例:float('3.14') 的结果是数值 3.14
#int()函数可以把整数字符串转为整数
#例:int('5') 的结果是数值 5
输入格式
第一行输入一个数字,代表矩形的长
第二行输入一个数字,代表矩形的宽
(输入使用input(),不要增加额外的提示信息)
输出格式
输出矩形的面积,不限定小数位数
示例 1
输入:
3.1415926
5.88
输出:
18.472564488
示例 2
输入:
5
8
输出:
40 解:
#用户输入长和宽,计算矩形的面积
width = eval(input()) # 输入宽
length = eval(input()) # 输入长
area = width * length # 计算面积
print(area) # 输出面积
边栏推荐
- How to become a senior digital IC Design Engineer (4-5) script: file comparison operation implemented by shell script
- RISC CPU design based on FPGA (4) 36 questions about the project and their answers
- Ambiguity between 0 and 1
- 如何成为一名高级数字 IC 设计工程师(6-5)数字 IC 验证篇:覆盖率收集
- [redis] data introduction & General Command & string type
- 利用kubernetes資源鎖完成自己的HA應用
- Understand flex layout in an article
- SQL splits strings into tables
- 为什么要在网站上安装SSL证书?
- 请问etf基金是否靠谱,安全吗
猜你喜欢

Live broadcast preview | can SQL also play industrial machine learning? Mlops meetup V3 takes you to the bottom!
![[redis] hash type](/img/8b/2585908318f5fe88b455323d3f392e.png)
[redis] hash type

TiFlash 面向编译器的自动向量化加速

Zhongyi technology resumed the review status of the gem IPO, and xuxiaofei no longer acted as a practicing lawyer
![[redis] set type](/img/97/0a83016e89316849c01072044f2124.png)
[redis] set type

How to become a senior digital IC Design Engineer (4-5) script: file comparison operation implemented by shell script

SQL splits strings into tables

【Redis】Set类型

2022.02.15

Use code binding DataGridView control to display tables in program interface
随机推荐
Necessary technologies for chip manufacturers (1) Introduction
Examen final de troisième année
Kubernetes: container resource requirements and constraints (constraints)
【Redis】List类型
Why is it recommended that you choose the self research company as much as possible
Cross border information station
KOA Quick Start
【Redis】数据介绍 & 通用命令 & String类型
Exclusive analysis | real situation of software test about resume and interview
QT basics tutorial: data types and containers
东方财富股票开户是会有什么风险吗?东方财富开户安全吗
[redis] data introduction & General Command & string type
Finally got the byte offer. The 25-year-old inexperienced experience in software testing is written to you who are still confused
【网络通信学习笔记】Socket.IO的搭建和部署
CTFHub-Web-SQL注入-整数型注入
[redis] sortedset type
【学习笔记】子集和问题
[apprendre la programmation FPGA - 49 à partir de zéro]: vision - Comment la puce a - t - elle été conçue?
How to become a senior digital IC Design Engineer (6-5) digital IC Verification: coverage collection
【Redis】Set类型