0

0

周末任务

花韻仙語

花韻仙語

发布时间:2024-12-02 09:03:01

|

1002人浏览过

|

来源于dev.to

转载

周末任务

1.华氏温度到摄氏度转换:

def fahrenheit_to_celsius():
    celsius=(fahrenheit-32)*5/9
    return celsius

fahrenheit=float(input("enter the fahrenheit:"))
celsius=fahrenheit_to_celsius()
print("celsius :",round(celsius,1)

enter the fahrenheit:102.3
celsius : 39.1

2.摄氏度到华氏度转换:

def celsius_to_fahrenheit():
    fahrenheit=celsius*9/5+32
    return fahrenheit

celsius=float(input("enter the celsius:"))
fahrenheit=celsius_to_fahrenheit()
print("fahrenheit :",round(fahrenheit,1))

enter the celsius:39.1
fahrenheit : 102.4

3.英尺到米换算:

def feet_to_meter():
    meter=feet*0.3048
    return meter

feet=float(input("enter the feet:"))
meter=feet_to_meter()
print("meter :",round(meter,3))

enter the feet:12
meter : 3.658

4.求正方形的面积:

def area_of_square():
    area=side**2
    return area

side=float(input("enter the side:"))
area=area_of_square()
print("area :",round(area,2))

enter the side:12.3
area : 151.29

5.求矩形的面积:

def area_of_rectangle():
    area=length*width
    return area

length=float(input("enter the length:"))
width=float(input("enter the width:"))
area=area_of_rectangle()
print("area :",round(area,2))

enter the length:13.4
enter the width:9.6
area : 128.64

6.求圆的面积:

def area_of_circle():
    area=3.14*radius**2
    return area

radius=float(input("enter the radius:"))
area=area_of_circle()
print("area :",round(area,2))
enter the radius:7.2
area : 162.78

7.sgd 到 inr 换算:

def sgd_to_inr():
    inr=63.14*sgd
    return inr

sgd=float(input("enter the sgd:"))
inr=sgd_to_inr()
print("inr:",round(inr,2))

enter the sgd:23
inr: 1452.22

8.新加坡时间与印度标准时间换算:

from datetime import datetime, timedelta

current= datetime.now()
current_time= current.strftime("%h:%m:%s")
print("singapore time:",current_time)

difference= timedelta(hours=2, minutes=30)
print("difference between singapore and indian time",difference)

difference=current-difference
print("indian time:",difference.strftime("%h:%m:%s"))
singapore time: 01:32:00
difference between singapore and indian time 2:30:00
indian time: 23:02:00

9) 7, 10, 8, 11, 9, 12, 10

Levity
Levity

AI帮你自动化日常任务

下载
no=7
count=0
while count<7:
    print(no, end=" ")
    if count%2==0:
        no=no+3
    else:
        no=no-2
    count+=1
7, 10, 8, 11, 9, 12, 10

10) 36, 34, 30, 28, 24, 22

no=36
difference=2
while no>=22:
    print(no,end=" ")
    if difference==2:
        no=no-difference
        difference+=2
    else:
        no=no-difference
        difference-=2
36, 34, 30, 28, 24, 22

11) 22, 21, 23, 22, 24, 23

no=22
difference=1
while no<25:
    print(no,end=" ")
    if difference==1:
        no=no-difference
        difference+=1
    else:
        no=no+difference
        difference-=1
22, 21, 23, 22, 24, 23

12) 53, 53, 40, 40, 27, 27

no=53
difference=13
while no>=27:
    print(no, end=" ")
    print(no, end=" ")
    if difference==13:
        no=no-difference

53, 53, 40, 40, 27, 27

13) 21, 9, 21, 11, 21, 13, 21

odd_no=21
even_no=9
count=0
while count<7:

    if count%2==0:
        print(odd_no,end=" ")
    else:
        print(even_no,end=" ")
        even_no=even_no+2
    count+=1
21, 9, 21, 11, 21, 13, 21

14) 3, 4, 7, 8, 11, 12

no=3
difference=1
while no<=12:
    print(no,end=" ")
    if difference==1:
        no=no+1
        difference+=2
    else:
        no=no+3
        difference-=2

3, 4, 7, 8, 11, 12

15) 14, 28, 20, 40, 32, 64

no=14
count=0

while count<6:

    if count%2==0:
        print(no, end=" ")
        no=no*2
    else:
        print(no, end=" ")
        no=no-8
    count+=1
14, 28, 20, 40, 32, 64

本站声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

相关专题

更多
Java编译相关教程合集
Java编译相关教程合集

本专题整合了Java编译相关教程,阅读专题下面的文章了解更多详细内容。

9

2026.01.21

C++多线程相关合集
C++多线程相关合集

本专题整合了C++多线程相关教程,阅读专题下面的的文章了解更多详细内容。

3

2026.01.21

无人机驾驶证报考 uom民用无人机综合管理平台官网
无人机驾驶证报考 uom民用无人机综合管理平台官网

无人机驾驶证(CAAC执照)报考需年满16周岁,初中以上学历,身体健康(矫正视力1.0以上,无严重疾病),且无犯罪记录。个人需通过民航局授权的训练机构报名,经理论(法规、原理)、模拟飞行、实操(GPS/姿态模式)及地面站训练后考试合格,通常15-25天拿证。

15

2026.01.21

Python多线程合集
Python多线程合集

本专题整合了Python多线程相关教程,阅读专题下面的文章了解更多详细内容。

1

2026.01.21

java多线程相关教程合集
java多线程相关教程合集

本专题整合了java多线程相关教程,阅读专题下面的文章了解更多详细内容。

3

2026.01.21

windows激活码分享 windows一键激活教程指南
windows激活码分享 windows一键激活教程指南

Windows 10/11一键激活可以通过PowerShell脚本或KMS工具实现永久或长期激活。最推荐的简便方法是打开PowerShell(管理员),运行 irm https://get.activated.win | iex 脚本,按提示选择数字激活(选项1)。其他方法包括使用HEU KMS Activator工具进行智能激活。

2

2026.01.21

excel表格操作技巧大全 表格制作excel教程
excel表格操作技巧大全 表格制作excel教程

Excel表格操作的核心技巧在于 熟练使用快捷键、数据处理函数及视图工具,如Ctrl+C/V(复制粘贴)、Alt+=(自动求和)、条件格式、数据验证及数据透视表。掌握这些可大幅提升数据分析与办公效率,实现快速录入、查找、筛选和汇总。

6

2026.01.21

毒蘑菇显卡测试网站入口 毒蘑菇测试官网volumeshader_bm
毒蘑菇显卡测试网站入口 毒蘑菇测试官网volumeshader_bm

毒蘑菇VOLUMESHADER_BM测试网站网址为https://toolwa.com/vsbm/,该平台基于WebGL技术通过渲染高复杂度三维分形图形评估设备图形处理能力,用户可通过拖动彩色物体观察画面流畅度判断GPU与CPU协同性能;测试兼容多种设备,但中低端手机易卡顿或崩溃,高端机型可能因发热降频影响表现,桌面端需启用独立显卡并使用支持WebGL的主流浏览器以确保准确结果

17

2026.01.21

github中文官网入口 github中文版官网网页进入
github中文官网入口 github中文版官网网页进入

github中文官网入口https://docs.github.com/zh/get-started,GitHub 是一种基于云的平台,可在其中存储、共享并与他人一起编写代码。 通过将代码存储在GitHub 上的“存储库”中,你可以: “展示或共享”你的工作。 持续“跟踪和管理”对代码的更改。

7

2026.01.21

热门下载

更多
网站特效
/
网站源码
/
网站素材
/
前端模板

精品课程

更多
相关推荐
/
热门推荐
/
最新课程
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号