# 实验报告1: # print(31*"*") # print("单号:DH201409230001") # print("时间:2014-09-23 08:56:14") # print("-------------------------------") # print("名称\t\t\t数量\t\t单价\t\t金额") # print("金士顿U盘\t 1\t\t40.00\t40.00") # print("8G") # print("胜创16GTF\t 1\t\t50.00\t50.00") # print("卡") # print("读卡器\t\t 1\t\t8.00\t8.00") # print("网线2米\t\t 1\t\t5.00\t5.00") # print('--------------------------------') # print("总数:4\t\t\t总额103.00") # print("折后总额:103.00") # print("实收:103.00\t\t找零:0.00") # print("收银:管理员") # print('...........by-caojing...........') # # zhengshu = " 植树证书1\n" # word1 = "你于2019年11月3日申请种植的梭梭树," # word2 = "已被中国扶贫基金会认领,将种植到武威" # word3 = "地区" # bianhao1 = " 树苗编号" # bianhao2 = " NO.HFK20308960305" # print(zhengshu,word1,word2,word3,bianhao1,bianhao2,sep="\n") # # r=float(input("请输入圆的半径:")) # R=2*r # S=3.14*r**2 # print("圆的半径为:",r,"圆的直径为:",R,"圆的面积为:",S) # # # # # a = float(input("请输入温度:"))#input接收的是字符串型,无法和数字直接进行加减,要用float进行转换 # k = a + 273.15 # print(a, "℃对应的开氏度为:",k,"k") # # # weight=float(input("请输入体重:")) # high=float(input("请输入身高:")) # print("体重:",weight,"kg,身高:",high,"m") # BIM=weight/high**2 # print("身体指数为:",BIM) # print('.........by-caojing...........') # # # 实验报告三 # while True: # loan_type = input("请输入贷款类型:1.商业贷款 2.公积金贷款 3.组合贷款:\n") # if loan_type != "3": # loan_amount = float(input("输入贷款金额(万):\n")) # term = int(input("请输入贷款年限:5、10、15、20、25、30\n")) # if term in [5, 10, 15, 20, 25, 30]: # if loan_type == "1": # if term == 5: # mon_rate = (4.75 / 100) / 12 # else: # mon_rate = (4.90 / 100) / 12 # mon_pay = loan_amount * 10000 * ( # mon_rate * (1 + mon_rate) ** (term * 12) / # ((1 + mon_rate) ** (term * 12) - 1)) # all_pay = mon_pay * term * 12 # interest = all_pay - loan_amount * 10000 # print("每个月月供参考(元):{:.2f}元".format(mon_pay)) # print("支付利息(元):{:.2f}元".format(interest)) # print("还款总额(元):{:.2f}元".format(all_pay)) # elif loan_type == "2": # if term == 5: # mon_rate = (2.75 / 100) / 12 # else: # mon_rate = (3.25 / 100) / 12 # mon_pay = loan_amount * 10000 * ( # mon_rate * (1 + mon_rate) ** (term * 12) / # ((1 + mon_rate) ** (term * 12) - 1)) # all_pay = mon_pay * term * 12 # interest = all_pay - loan_amount * 10000 # print("每个月月供参考(元):{:.2f}元".format(mon_pay)) # print("支付利息(元):{:.2f}元".format(interest)) # print("还款总额(元):{:.2f}元".format(all_pay)) # else: # print("请输入正确的年限") # else: # loan_amount1 = float(input("输入商业贷款金额(万):\n")) # term1 = int(input("请输入商业贷款年限:5、10、15、20、25、30\n")) # if term1 in [5, 10, 15, 20, 25, 30]: # if term1 == 5: # mon_rate1 = (4.75 / 100) / 12 # else: # mon_rate1 = (4.90 / 100) / 12 # mon_pay1 = loan_amount1 * 10000 * ( # mon_rate1 * (1 + mon_rate1) ** (term1 * 12) / # ((1 + mon_rate1) ** (term1 * 12) - 1)) # all_pay1 = mon_pay1 * term1 * 12 # interest1 = all_pay1 - loan_amount1 * 10000 # loan_amount2 = float(input("输入公积金贷款金额(万):\n")) # term2 = int(input("请输入公积金贷款年限:5、10、15、20、25、30\n")) # if term2 in [5, 10, 15, 20, 25, 30]: # if term2 == 5: # mon_rate2 = (4.75 / 100) / 12 # else: # mon_rate2 = (4.90 / 100) / 12 # mon_pay2 = loan_amount2 * 10000 * ( # mon_rate2 * (1 + mon_rate2) ** (term2 * 12) / # ((1 + mon_rate2) ** (term2 * 12) - 1)) # all_pay2 = mon_pay2 * term2 * 12 # interest2 = all_pay2 - loan_amount2 * 10000 # mon_pay3 = (mon_pay1+mon_pay2)/2 # all_pay3 = all_pay1+all_pay2 # interest3 = interest1+interest2 # print("每个月月供参考(元):{:.2f}元".format(mon_pay3)) # print("支付利息(元):{:.2f}元".format(interest3)) # print("还款总额(元):{:.2f}元".format(all_pay3)) # # 实验二 # print("请您输入两个数") # a = input() # b = input() # print("请选择您使用的运算") # print("1.加法") # print("2.减法") # print("3.乘法") # print("4.除法") # operation=input() # sum1=float(a)+float(b) # sum2=float(a)-float(b) # sum3=float(a)*float(b) # sum4=float(a)/float(b) # if operation==1: # print('两数相加为',sum1) # elif operation==2: # print("您选择的是减法",sum2) # elif operation==3: # print("您选择的是乘法",sum3) # else: # print('您选择的是除法:{0}/{1}={2}'.format(float(a),float(b),sum4)) # # # # # count = 100 # while (count >= 0): # if "7" in str(count) or int(count) % 7 == 0: # print("*") # elif "7" not in str(count) and int(count) % 7 != 0: # print(count) # count-=1 # # for i in range(1,101): # if "7" in str(i) or int(i) % 7 == 0: # print("拍手",end=' ') # elif "7" not in str(i) and int(i) % 7 != 0: # print(i,end=' ') # # # # # # num=input("输入一个设定的数") # count = 5 # while (count > 0): # count -= 1 # number = input("请输入100以内的整数:") # if number.isdigit() is False: # print("请输入一个正确的数字") # elif number>num: # print("你猜大了") # elif number<num: # print("你猜小了") # else: # print("恭喜你赢了") # print(f'一共猜了{5-count}次') # break # if count == 0: # print('游戏结束') # print(f'你还剩{count}次机会') # # # # 实验报告四 # # # # 进制转换 # while True: # num = int(input("请输入要转换的数:")) # change = input("请选择转换进制:2、8、16\n") # if change == '2': # print(f"二进制转换后的数为:{bin(num)}") # elif change == '8': # print("八进制转换后的数为:%s" % oct(num)) # elif change == '16': # string="十六进制转换后的数为:{}" # print(string.format(hex(num))) # # # # #进度条 # import time # sign=50#.的数量 # str="开始下载" # str2="下载完成" # str1=str.center(52,'=') # str3=str2.center(52,'=') # print(f'{str1}') # for i in range(sign+1): # completed='*'*i # incompleted='.'*(sign-i) # p=(i/sign)*100 # print("\r{:.0f}%[{}{}]".format(p,completed,incompleted),end=""