zoukankan      html  css  js  c++  java
  • 作业二

    #温度转换
    while True:
    a = int(input("华氏温度转换为摄氏温度请按1 摄氏温度转换为华氏温度请按2 "))
    if a ==1:
    fahrenheit = float(input("请输入华氏温度:"))
    #温度计算
    celsius = (fahrenheit*1.8)+32
    #输出温度
    print("{}华氏温度转为摄氏温度为{}".format(celsius,fahrenheit));
    elif a ==2:
    fahrenheit = float(input('请输入摄氏温度'))
    celsius = 5/9*(fahrenheit - 32)
    print('{}摄氏温度转换为华氏温度为:{}'.format(fahrenheit,celsius));
    else:
    break;

    #数字竞猜
    import random
    secret = random.randint(1,10)
    #输入数字
    print('猜数字游戏')
    guess = -2
    while guess !=secret:
    a = input('请输入数字:')
    guess = int(a)
    if guess > secret:
    print('输入的数字太大了!')
    elif guess < secret :
    print('输入的数字太小了!')
    else:
    print('猜对了!')
    print('游戏结束')

    #身份证号码提取
    myid = '441225199609063246'

    age = 2018-int(myid[6:10])

    if int(myid[-2])%2==0:
    sex = 'girl'
    else:
    sex = "boy"
    print(age,sex)

    #制作网址
    for i in range(2,10):
    print('http://news.gzcc.cn/html/xiaoyuanxinwen/'+str(i)+'.html')

    #学号提取
    s = '201606050039'
    a = s[:4]
    b = s[4:6]
    c = s[6:8]
    d = s[8:]
    print('年纪{}'.format(a))
    print('学院{}'.format(b))
    print('班级{}'.format(c))
    print('学号{}'.format(d))

    
    
    
    
    
    
    
    
    
    
  • 相关阅读:
    2021.01.28 Rating赛
    2021.01.23 Rating赛补题报告
    Codeforces Round #104 (Div.2)补题报告
    Codeforces Beta Round #73(Div2)补题报告
    11.28天梯赛补题报告
    11月22日天梯训练补题报告
    11.14补题报告
    CCNA笔记
    Centos上安装mysql配置并授权远程连接部署项目
    web容器(03):Nginx配置负载均衡
  • 原文地址:https://www.cnblogs.com/SJMHJ/p/9639595.html
Copyright © 2011-2022 走看看