homework01

#华氏温度
‘’’
celsius = int(input(“Enter a degree in Celsius:”))
fashrenheit = (9 / 5) * celsius + 32
print(’{} Celsius is {} Fahren’.format(celsius,fashrenheit))
‘’’
#圆柱体的体积
‘’’
import math
radius = float(input(“Enter the radius of a cylinder:”))
lenght = int(input(“Enter the lenght of a cylinder:”))
area = radius * radius * math.pi
volume = area * lenght
print(“The area is {}”.format(area))
print(“The volume is {}”.format(lenght))
‘’’
#英尺数换算米数
‘’’
feet = float(input(“Enter a value for feet :”))
meters = 0.305 * feet
print("{} feet is {} meters".format(feet,meters))
‘’’
#计算能量
‘’’
M = float(input(“Enter the amount of water in kilograms :”))
initialTemperature = float(input(“Enter the initial temperature :”))
finalTemperature = float(input(“Enter the final temperature :”))
Q = M * (finalTemperature - initialTemperature) * 4184
print(“The energy needed is %.1f” % Q)
‘’’
#计算利息
‘’’
balance = int(input(“Enter balance :”))
rate = float(input(“Enter interest rate :”))/100
interest = (rate / 12) * balance
print(“The interst is %f” % interest)
‘’’
#加速度
‘’’
v0 =float(input(“Enter v0,v1 and t:”))
v1 = float(input())
t = float(input())
a = (v1 - v0) / t
print(“The average acceleration is %f” % a)
‘’’
#复利值
‘’’
money = input(“Enter the monthly saving amount:”)
n_rate = 0.05
m_rate = 0.05 / 12
mm_rate = 1+m_rate
b = [0]
for i in range(6):
c = (100 + b[i]) * mm_rate
b.append©
#print(b)
print(“After the sixth month ,the account value is %.2f” % b[6])
‘’’
#整数每位数之和
‘’’
import random
count = random.randint(0,1000)
ge = count % 10
shi = count // 10 % 10
bai = count //100
sum = ge + shi + bai
print(“Enter a number between 0 and 1000: %d” % count)
print(“The sum of the digits is %d” % sum)
‘’’
#账号密码登录
‘’’
import random
id = "1950502061@qq.com"
password = “123456”
id_1 = input(“请输入账号:”)
password_1 = input(“请输入密码:”)
c = 0
for i in range(3):
if "@qq.com" in id or "@163.com" in id:
if idid_1 or passwordpassword_1:
print(“登录成功”)
break
else:
print(“账号和密码错误,请重新输入!!”)
id_1 = input(“请输入账号:”)
password_1 = input(“请输入密码:”)
check_ma = random.randint(1000,9999)
print(check_ma)
check = input(“请输入验证码:”)
c += 1
if c>2 :
print(“账号已锁,请持本人身份证解锁!!!”)
break
else:
print(“账号不正确”)
‘’’
#md5加密
import hashlib
hash = hashlib.md5()
hash.update(‘kkkkkkk01456’.encode(“utf-8”))
print(hash.hexdigest())

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值