猫史档案馆


【Python作品分享】功能大全【作品秀】

用户:编程小学生5年级编程小学生5年级查看:0 回复:1 评论:0 创建时间:2020-06-19T18:08:58


【作品展示】

center_image

 

【作品介绍】

有许多功能

慢慢找 吧,我这里不都说了。

 

【作品源代码】

from __future__ import division
import math, time, random, decimal, qrcode, re
import urllib.request, urllib.parse, json, sys
import requests
#导入库


def jiecheng1(n):

    return jiecheng2(n, 1)

def jiecheng2(num, product):

    if (num == 1):
        return product
    return jiecheng2(num - 1, num * product)
#阶乘

def movehannuo(movethings, a, b, c):  #汉诺塔

    if (movethings == 1):
        print(a, '-->', c)
    else:
        movehannuo(movethings - 1, a, c, b)
        movehannuo(1, a, b, c)
        movehannuo(movethings - 1, b, a, c)

def 质数(choice):  #质数

    if (choice == '判断质数'):
        ask = int(input('请输入数:'))  #输入数字
        active_质数 = math.ceil(math.sqrt(ask))  #判断需要试几次
        质数_try = 2  #测试数
        while True:
            if (active_质数 >= 质数_try):
                if (ask % 质数_try == 0):
                    print('这个数不是质数,它的表达式:', 质数_try, '*', math.ceil(ask / 质数_try))
                    break
                else:
                    质数_try += 1
            else:
                print('这个数是质数')
                break
    if (choice == '打印质数表'):
        printf = str(input('100以内,1000以内还是1000-5000以内?(输入数字)'))  #选择质数表
        if (printf == '100'):
            print('''
            ---------------------------------
            2 3 5 7
            11 13 17 19
            23 29
            31 37
            41 43 47
            53 59
            61 67
            71 73 79
            83 89
            97
            ''')
        elif (printf == '1000'):
            print('''
            ---------------------------------------------
            2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107
            109 113 127 131 137 139 149 151 157 163 167 173 179 181 191 193 197 199 211 223
            227 229 233 239 241 251 257 263 269 271 277 281 283 293 307 311 313 317 331 337
            347 349 353 359 367 373 379 383 389 397 401 409 419 421 431 433 439 443 449 457
            461 463 467 479 487 491 499 503 509 521 523 541 547 557 563 569 571 577 587 593
            599 601 607 613 617 619 631 喵1 喵3 喵7 653 659 661 673 677 683 691 701 709 719
            727 733 739 743 751 757 761 769 773 787 797 809 811 821 823 827 829 839 853 857
            859 863 877 881 883 887 907 911 919 929 937 941 947 953 967 971 977 983 991 997''')
            time.sleep(10)
        elif (printf == '1000-5000'):
            x = ('''
            -----------------------------------------------------
            1009 1013
            1019 1021 1031 1033 1039 1049 1051 1061 1063 1069
            1087 1091 1093 1097 1103 1109 1117 1123 1129 1151
            1153 1163 1171 1181 1187 1193 1201 1213 1217 1223
            1229 1231 1237 1249 1259 1277 1279 1283 1289 1291
            1297 1301 1303 1307 1319 1321 1327 1361 1367 1373
            1381 1399 1409 1423 1427 1429 1433 1439 1447 1451
            1453 1459 1471 1481 1483 1487 1489 1493 1499 1511
            1523 1531 1543 1549 1553 1559 1567 1571 1579 1583
            1597 1601 1607 1609 1613 1619 1621 1627 1637 1657
            1663 1667 1669 1693 1697 1699 1709 1721 1723 1733
            1741 1747 1753 1759 1777 1783 1787 1789 1801 1811
            1823 1831 1847 1861 1867 1871 1873 1877 1879 1889
            1901 1907 1913 1931 1933 1949 1951 1973 1979 1987
            1993 1997 1999 2003 2011 2017 2027 2029 2039 2053
            2063 2069 2081 2083 2087 2089 2099 2111 2113 2129
            2131 2137 2141 2143 2153 2161 2179 2203 2207 2213
            2221 2237 2239 2243 2251 2267 2269 2273 2281 2287
            2293 2297 2309 2311 2333 2339 2341 2347 2351 2357
            2371 2377 2381 2383 2389 2393 2399 2411 2417 2423
            2437 2441 2447 2459 2467 2473 2477 2503 2521 2531
            2539 2543 2549 2551 2557 2579 2591 2593 2609 2617
            2621 2633 2喵7 2657 2659 2663 2671 2677 2683 2687
            2689 2693 2699 2707 2711 2713 2719 2729 2731 2741
            2749 2753 2767 2777 2789 2791 2797 2801 2803 2819
            2833 2837 2843 2851 2857 2861 2879 2887 2897 2903
            2909 2917 2927 2939 2953 2957 2963 2969 2971 2999
            3001 3011 3019 3023 3037 3041 3049 3061 3067 3079
            3083 3089 3109 3119 3121 3137 3163 3167 3169 3181
            3187 3191 3203 3209 3217 3221 3229 3251 3253 3257
            3259 3271 3299 3301 3307 3313 3319 3323 3329 3331
            3343 3347 3359 3361 3371 3373 3389 3391 3407 3413
            3433 3449 3457 3461 3463 3467 3469 3491 3499 3511
            3517 3527 3529 3533 3539 3541 3547 3557 3559 3571
            3581 3583 3593 3607 3613 3617 3623 3631 3637 3喵3
            3659 3671 3673 3677 3691 3697 3701 3709 3719 3727
            3733 3739 3761 3767 3769 3779 3793 3797 3803 3821
            3823 3833 3847 3851 3853 3863 3877 3881 3889 3907
            3911 3917 3919 3923 3929 3931 3943 3947 3967 3989
            4001 4003 4007 4013 4019 4021 4027 4049 4051 4057
            4073 4079 4091 4093 4099 4111 4127 4129 4133 4139
            4153 4157 4159 4177 4201 4211 4217 4219 4229 4231
            4241 4243 4253 4259 4261 4271 4273 4283 4289 4297
            4327 4337 4339 4349 4357 4363 4373 4391 4397 4409
            4421 4423 4441 4447 4451 4457 4463 4481 4483 4493
            4507 4513 4517 4519 4523 4547 4549 4561 4567 4583
            4591 4597 4603 4621 4637 4639 4喵3 4喵9 4651 4657
            4663 4673 4679 4691 4703 4721 4723 4729 4733 4751
            4759 4783 4787 4789 4793 4799 4801 4813 4817 4831
            4861 4871 4877 4889 4903 4909 4919 4931 4933 4937
            4943 4951 4957 4967 4969 4973 4987 4993 4999 ''')
            print(x)
            time.sleep(60)
        else:
            pass
        
def math_plus(first,second,third,fourth):
    plus_num = int(input('请输入有几个加数(最多四个):'))
    if plus_num == 2:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        print(first + second)
    elif plus_num == 3:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        third = int(input('请输入第三个:'))
        print(first + second + third)
    elif plus_num == 4:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        third = int(input('请输入第三个:'))
        fourth = int(input('请输入第四个:'))
        print(first + second + third + fourth)

def math_multiplication(first, second, third, fourth):
    multi_num = int(input('请输入有几个乘数(最多四个):'))
    if multi_num == 2:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        print(first * second)
    elif multi_num == 3:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        third = int(input('请输入第三个:'))
        print(first * second * third)
    elif multi_num == 4:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        third = int(input('请输入第三个:'))
        fourth = int(input('请输入第四个:'))
        print(first * second * third * fourth)

def math_minus(first, second, third, fourth):
    minus_num = int(input('请输入有几个减数(最多四个):'))
    if minus_num == 2:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        print(first - second)
    elif minus_num == 3:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        third = int(input('请输入第三个:'))
        print(first - second - third)
    elif minus_num == 4:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        third = int(input('请输入第三个:'))
        fourth = int(input('请输入第四个:'))
        print(first - second - third - fourth)

def math_division(first, second, third, fourth):
    divis_num = int(input('请输入有几个加数(最多四个):'))
    if divis_num == 2:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        print(first / second)
    elif divis_num == 3:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        third = int(input('请输入第三个:'))
        print(first / second / third)
    elif divis_num == 4:
        first = int(input('请输入第一个:'))
        second = int(input('请输入第二个:'))
        third = int(input('请输入第三个:'))
        fourth = int(input('请输入第四个:'))
        print(first / second / third / fourth)

def pi(time1,number,number1,b,x1,x2,he,pai,paistr,result,time2,quit):
    time1 = time.time()
    number = int(input('请输入想要计算到小数点后的位数n:'))
    # 多计算10位,防止尾数取舍的影响
    number1 = number+10
    # 算到小数点后number1位
    b = 10**number1
    # 求含4/5的首项
    x1 = b*4//5
    # 求含1/239的首项
    x2 = b // -239
    # 求第一大项
    he = x1+x2
    #设置下面循环的终点,即共计算n项
    number *= 2
    #循环初值=3,末值2n,步长=2
    for i in range(3, number, 2):
    # 求每个含1/5的项及符号
        x1 //= -25
        # 求每个含1/239的项及符号
        x2 //= -57121
        # 求两项之和
        x = (x1+x2) // i
        # 求总和
        he += x
        # 求出π
        pai = he*4
        #舍掉后十位
        pai //= 10**10
    ############ 输出圆周率π的值
    paistr= str(pai)
    result = paistr[0]+str('.')+paistr[1:len(paistr)]
    print(result)
    time2 = time.time()
    print('总共耗时:' + str(time2 - time1) + 's')
    while quit:
        quit = int(input('如果看完请输入1'))

def e(e,x,y):

    decimal.getcontext().prec = e
    p = []
    for i in range((2 * e), 0, (-2)):
        p.append(1)
        p.append(i)
        p.append(1)
    p.append(2)
    x = p.pop(0)
    while (len(p) >= 1):
        y = (1 / decimal.Decimal(x))
        x = (p.pop(0) + y)
    return x

def domath():  # 数学计算

    if (q == '数学计算'):
        mathuse = str(input('请输入您想要实现的功能(输入quit退出):'))
        if (mathuse == 'quit'):
            sys.exit()
        if (mathuse == '四舍五入'):
            roundnum = float(input('请输入您想要四舍五入的数:'))  #数
            roundplace = int(input('请输入您想要四舍五入的位数:'))  #位数
            print('原数:', roundnum, '四舍五入到第', roundplace, '位:', round(roundnum, roundplace))
        elif (mathuse == 'n次方'):
            xnumber = int(input('请输入您想要进行幂运算的数:'))
            ynumber = int(input('请输入,要进行几次幂:'))
            print('结果:', (xnumber ** ynumber))
        elif (mathuse == '取余'):
            first = int(input('请输入被除数:'))
            second = int(input('请输入除数:'))
            last = (first % second)
            print('余数是:', last)
        elif (mathuse == '取整'):
            beichushu = int(input('请输入被除数:'))
            chushu = int(input('请输入除数:'))
            shang = ((beichushu - beichushu % chushu) / chushu)
            print(shang)
        elif (mathuse == '阶乘'):
            n = int(input('请输入阶乘数(即输入n)n!:'))
            print(jiecheng1(n))
        elif (mathuse == '汉诺塔问题'):
            movethings = int(input('请输入汉诺塔的个数:'))
            movehannuo(movethings, 'A', 'B', 'C')
            print('一共需要', (2 ** movethings - 1), '步')
            time.sleep(2 ** movethings)
        elif (mathuse == '质数'):
            质数(input('请输入:判断质数或者打印质数表?'))
        elif mathuse == '分数化小数':
            upper_num = int(input('请输入分子:'))
            lower_num = int(input('请输入分母:'))
            up_low = upper_num/lower_num
            print('结果是:',up_low)
        elif mathuse == '加法':
            math_plus(0,0,0,0)
        elif mathuse == '减法':
            math_minus(0,0,0,0)
        elif mathuse == '除法':
            math_division(0,0,0,0)
        elif mathuse == '乘法':
            math_multiplication(0,0,0,0)
        elif mathuse == '计算圆周率':
            pi(0,0,0,0,0,0,0,0,0,0,0,quit = 0)
        elif mathuse == '计算自然常数e':
            print(e(int(input('请输入要算e后第几位(可能有1-3位误差):')),0,0))
        else:
            pass

def playguess():

    puzzle_list = ['一只黑狗,不叫不吼', '一口咬定', '一加一', '一只狗四个口', '九点', '十二点']
    riddle_list = ['默', '交', '王', '器', '丸', '斗']
    while (len(puzzle_list) != 0):
        random_index = random.randint(0, (len(puzzle_list) - 1))
        puzzle = puzzle_list[random_index]
        print('请根据一下谜题,输入谜底进行解答,猜一个字')
        answer = input((puzzle + ':'))
        if (answer == riddle_list[random_index]):
            print('恭喜你猜对了')
            puzzle_list.pop(random_index)
            riddle_list.pop(random_index)
        else:
            print('很遗憾,猜错了')

def playnumber():

    min_num = 0
    max_num = 300
    numanswer = random.randint(0, 300)
    guess_num = (-1)
    guess_times = 7
    print('狡猾的数字')
    while (guess_num != numanswer):
        if (guess_times == 0):
            print('很遗憾,没猜对!')
            break
        print(min_num, '<= ? <=', max_num)
        guess_num = int(input('请输入猜想数字:'))
        if (guess_num > max_num or guess_num < min_num):
            print('注意范围!')
            continue
        if (guess_num == numanswer):
            print('恭喜你,猜对了!')
        elif (guess_num > numanswer):
            max_num = guess_num
        else:
            min_num = guess_num
        guess_times = (guess_times - 1)

def playautocodemao():

    print('欢迎使用CodeMao加法智能出题器')
    around = int(input('请输入你想要挑战的加数范围,例如:0-100(输入100)'))
    print('您已经选择', around, '的范围')
    print('挑战马上开始,请在5秒内作答')
    score = 0
    for z in range(10):
        print()
        one = random.randint(0, x)
        two = random.randint(0, x)
        promt = (((str(one) + '+') + str(two)) + '=?')
        print(promt)
        start_time = time.time()
        autocodemaoanswer = int(input('请输入你的答案:'))
        end_time = time.time()
        if (end_time - start_time >= 5):
            print('对不起,您已经超时')
        else:
            if (autocodemaoanswer == one + two):
                print('回答正确')
                score = (score + 1)
            else:
                print('回答错误')
    title = ''
    if (around <= 10 and score >= 6):
        title = '白银小将'
    elif (around <= 50 and score >= 7):
        title = '黄金大师'
    elif (around <= 100 and score >= 8):
        title = '荣耀宗师'
    elif (around > 100 and score >= 9):
        title = '至尊王者'
    else:
        pass
    print('获得的称号是:', title)

def hundred_name():
    
    family_name_list = ['李', '王', '张', '刘', '陈', '杨', '赵', '黄', '周', '吴', 
                    '徐', '孙', '胡', '朱', '高', '林', '何', '郭', '马', '罗', 
                    '梁', '宋', '郑', '谢', '韩', '唐', '冯', '于', '董', '萧', 
                    '程', '曹', '袁', '邓', '许', '傅', '沈', '曾', '彭', '吕', 
                    '苏', '卢', '蒋', '蔡', '贾', '丁', '魏', '薛', '叶', '阎', 
                    '余', '潘', '杜', '戴', '夏', '钟', '汪', '田', '任', '姜', 
                    '范', '方', '石', '姚', '谭', '廖', '邹', '熊', '金', '陆', 
                    '郝', '孔', '白', '崔', '康', '毛', '邱', '秦', '江', '史', 
                    '顾', '侯', '邵', '孟', '龙', '万', '段', '漕', '钱', '汤', 
                    '尹', '黎', '易', '常', '武', '乔', '贺', '赖', '龚', '文'] 

    def get(family_name):
        for i in family_name_list:
            if i == family_name:
                return '你的姓在百家姓中排:' + str(family_name_list.index(i)+1)
            else:
                return '你居然有那么罕见的姓,幸会幸会!'
    print(get(input('你的姓?:')))

def doplay():

    if (q == '游戏'):
        playthings = str(input('请输入您想要实现的功能(输入quit退出):'))
        if (playthings == 'quit'):
            sys.exit()
        elif (playthings == '猜字谜'):
            playguess()
        elif (playthings == '狡猾的数字'):
            playnumber()
        elif (playthings == '智能出题器'):
            playautocodemao()
        elif playthings == '百家姓':
            hundredname()
        else:
            pass

def time_now(year,month,date,day,time):

    print(year+'年'+month+'月'+date+'日'+' '+'星期'+day+' '+time)

def dotime():

    if (q == '时间'):
        timethings = str(input('请输入您想要实现的功能(输入quit退出):'))
        if (timethings == 'quit'):
            sys.exit()
        elif (timethings == '计时'):
            whatlong = int(input('请输入您要等待的时间(输入秒数):'))
            print('开始计时,请耐心等待')
            time.sleep(whatlong)
            while (promttime == ''):
                promttime = input('计时完毕!!!(请输入ok来退出,否则会一直提醒!):')
            time.sleep(1)
        elif timethings == '当前时间':
            strmonth = str(time.ctime()[4:7])
            if strmonth == 'Jan':
                strmonth = '一'
            elif strmonth == 'Feb':
                strmonth = '二'
            elif strmonth == 'Mar':
                strmonth = '三'
            elif strmonth == 'Apr':
                strmonth = '四'
            elif strmonth == 'May':
                strmonth = '五'
            elif strmonth == 'Jun':
                strmonth = '六'
            elif strmonth == 'Jul':
                strmonth = '七'
            elif strmonth == 'Aug':
                strmonth = '八'
            elif strmonth == 'Sep':
                strmonth = '九'
            elif strmonth == 'Oct':
                strmonth = '十'
            elif strmonth == 'Nov':
                strmonth = '十一'
            elif strmonth == 'Dec':
                strmonth = '十二'
                
            strday = str(time.ctime()[:3])
            if strday == 'Mon':
                strday = '一'
            elif strday == 'Tue':
                strday = '二'
            elif strday == 'Wed':
                strday = '三'
            elif strday == 'Thu':
                strday = '四'
            elif strday == 'Fri':
                strday = '五'
            elif strday == 'Sat':
                strday = '六'
            elif strday == 'Sun':
                strday = '七'
                
            time_now(year=time.ctime()[-4:],
            month = strmonth,
            date = time.ctime()[8:10],
            day = strday,
            time = time.ctime()[11:19])
            time.sleep(3)
        else:
            pass

def dofiles():

    if q == '文件':
        file_found = str(input('请输入你想实现的功能:'))
        if file_found == 'quit':
            sys.exit()
        elif file_found == '新建文件':
            file_create = str(input('请输入绝对路径(即将文件存放在哪里)(例:D:\codemao.txt):'))
            with open(file_create, 'w') as a:
                content_a = a.write('已创建完毕')
                print('已创建完毕')
        elif file_found == '写入文件(覆盖)':
            file_write_w = str(input('请输入文件:'))
            file_write_con = str(input('请输入内容:'))
            with open(file_write_w, 'w') as b:
                content_b = b.write(file_write_con)
                print('已完毕')
        elif file_found == '写入文件(追喵输入文件:'))
            file_append_con = str(input('请输入内容:'))
            with open(file_write_a, 'a') as c:
                content_c = f.write(file_append_con)
                print('已完毕')
        elif file_found == '读文件':
            file_read = str(input('请输入文件:'))
            with open(file_read) as d:
                content_d = f.read()
                print(content_d)
        else:
            pass

def make_qrcode(file_content,file_name,code_fill_color,code_back_color):

    if file_content == '':
        file_content = 'Hello World'
    if file_name == '':
        file_name = 'qrcode.png'
    if code_fill_color == '':
        code_fill_color = 'black'
    if code_back_color == '':
        code_back_color = 'white'

    qr = qrcode.QRCode(
    version = 1,
    error_correction=qrcode.constants.ERROR_CORRECT_L,
    box_size = 10,
    border = 4,
    )

    qr.add_data(file_content)

    qr.make(fit = True)
    img = qr.make_image(fill_color = code_fill_color,back_color = code_back_color)
    img.save(file_name)
    print('创建完成!')
    time.sleep(1)

def get_data(words):

        data = {}
        data["type"] = "AUTO"
        data["i"] = words
        data["doctype"] = "json"
        data["xmlVersion"] = "1.8"
        data["keyfrom:fanyi"] = "web"
        data["ue"] = "UTF-8"
        data["action"] = "FY_BY_CLICKBUTTON"
        data["typoResult"] = "true"
        data = urllib.parse.urlencode(data).encode('utf-8')
        return data

def url_open(url, data):

        req = urllib.request.Request(url, data)
        req.add_header(
            "User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW喵) AppleWebKit/537.36 (KH喵L, like Gecko) Chrome/44.0.2403.157 Safari/537.36")
        response = urllib.request.urlopen(req)
        html = response.read()
        html = html.decode("utf-8")
        return html

def get_json_data(html):

            result = json.loads(html)
            result = result['translateResult']
            result = result[0][0]['tgt']
            return result

def fanyi_main():

            words = input("please input words(输入***\/可以退出): ")
            if words == '***\/' or words == '***\/':
                print('已退出')
                sys.exit()
            url = "http://fanyi.youdao.com/translate?喵artresult=dict&喵artresult=rule&喵artresult=ugc&sessionFrom=dict.top"

            data = get_data(words)
            html = url_open(url, data)
            result = get_json_data(html)
            print("The result: %s" % result)

def science_fanyi():

    if __name__ == "__main__":
        while True:
            fanyi_main()

def get_tianqi():

    def get():
        print("天气查询小工具")
        str = input("请输入查询的城市:(汉字吆)")
        url = 'http://wthrcdn.etouch.cn/weather_mini?city='+str
        response = requests.get(url)
        wearher_json = json.loads(response.text)
        a = wearher_json['data']
        print("当前位置:"+a['city'])
        print("温馨提示:"+a['ganmao'])
        print("当前温度:"+a['wendu']+'℃')
        print("昨天:"+a['yesterday']['date'])
        print("风力:"+a['yesterday']['fl'][9:[m.start()
            for m in re.finditer(']', a['yesterday']['fl'])][0]])
        print("风向:"+a['yesterday']['fx'])
        print(a['yesterday']['high'])
        print(a['yesterday']['low'])
        print("天气:"+a['yesterday']['type'])
        print("--------------------------------")
        for i in range(0, 4):
            print("时间:"+a["forecast"][i]['date'])
            print('风力: '+a["forecast"][i]['fengli'][9:[m.start()
                for m in re.finditer(']', a['yesterday']['fl'])][0]])
            print('风向:'+a["forecast"][i]['fengxiang'])
            print(a["forecast"][i]['high'])
            print(a["forecast"][i]['low'])
            print("天气:"+a["forecast"][i]['type'])
            print("--------------------------------")
        os.system("")

    get()
    #版权声明:本文为CSDN博主「谢娘蓝桥」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    #原文链接:https: // blog.csdn.net/xinshuwei/java/article/details/86290453

def doScience():

    if q == '科学技术':
        Science_object = str(input('请输入您要实现的功能:'))
        if Science_object == 'quit':
            sys.exit()
        elif Science_object == '制作二维码':
            print('目前只能保存二维码到Python文件所在目录!!!')
            make_qrcode(
                file_content= str(input('请输入二维码内容(默认为Hello World):')),
                file_name = str(input('请输入图片名称(默认为qrcode.png):')),
                code_fill_color = str(input('请输入填充颜色(英文,默认为black):')),
                code_back_color=str(input('请输入背景颜色(英文,默认为white):'))
            )
        elif Science_object == '翻译':
            print('目前只支持中文翻译英文或英文翻译中文')
            science_fanyi()
        elif Science_object == '天气':
            get_tianqi()
            time.sleep(10)
while True:
    '''
    -----------------------
    项目         功能
    ------------------------
    数学计算   四舍五入,n次方
    数学计算  ,取余,取整,质数
    数学计算  ,阶乘,汉诺塔问题
    数学计算   ,分数化小数,
    数学计算  加法,减法,乘法,
    数学计算  除法,计算圆周率,
    数学计算  计算自然常数e
    时间        当前时间,计时
    科学技术   翻译,制作二维码
    科学技术  天气,电脑位数,
    科学技术  喵U温度
    游戏   猜字谜,狡猾的数字
    游戏   ,智能出题器,百家姓
    文件     新建文件,写入文件
    文件    (覆盖),写入文件
    文件     (追加),读文件
    ------------------------''')
    q = str(input('请输入您想要实现的项目(输入quit退出):'))  # 实现项目
    if (q == 'quit'):
        sys.exit()
    
    domath()
    doplay()
    dotime()
    dofiles()
    doScience()
    time.sleep(3)

 

【提示】

部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:

https://python.codemao.cn


回复

上一页1 页 / 共 1下一页
cLvcLv

你要加油,py代码要写的66的,像我一样

点赞0


评论