Python learning by case study@[April] (跟着April用真实案例学Python)-Lesson four-'round(), float()'

Python learning by case study@[April]
(跟着April用真实案例学Python)

Lesson three 第四讲
Python is one of the most popular programming languages in the world. It is necessary to grasp it before entering the workplace.

Python是世界上最流行的编程语言之一。 在进入职场前大家都有必要掌握这门语言。

TODAY’S FOCUS–“input(), float(), round()”

First, let’s have a look at the following code, try to guess the meaning of input(), int(), round()
首先看看下面的代码,试着看看input(),int(),round()在一起有什么作用。
case 1
The running output is below:
运行结果如下:
output-2
1.round(variable, x) # means Rounding variable up to a certain x number of decimal digits.
round()可以将变量的小数点确定到第x位。

2.float()#convert a string to a decimal number
把字符串格式转化为小数格式。

Secondly, let’s use input(), float(), round() together, to calculate the average mark for students.
接下来,我们用input(), float(), round()放在一起,来计算同学们的平均成绩。
case 2
The running output is below:
运行结果如下:case 2 output

So, you have learnt python float()’ and ‘round()’ in today’s lesson. See you next time.
今天,这节课里你学会了用 ‘float()’ 和 ‘round()’ 。下节课再见啦~
case 3
case 3 output

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值