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))

    
    
    
    
    
    
    
    
    
    
  • 相关阅读:
    vc生产垃圾清理
    完整的.h宏定义
    vs 2017 boost 安装目录 非安装
    cdlinux
    TryEnterCriticalSection
    go get 升级所有
    delphi win7 and high path
    本机激活Qemu网络配置 之桥接 win 10 2019 LTSC
    archlinux alsa安装,音量设置和音量信息保存
    windows搭建gcc开发环境(msys2) objdump
  • 原文地址:https://www.cnblogs.com/SJMHJ/p/9639595.html
Copyright © 2011-2022 走看看