上一页 1 2 3 4 5 6 7 8 9 10 ··· 13 下一页
摘要: 任务一: # 统计指定字符出现的次数 def get_count(s, ch): count = 0 for item in s: if ch.upper() == item or ch.lower() == item: count += 1 return count if __name__ == 阅读全文
posted @ 2022-08-05 15:52 tuyin 阅读(44) 评论(0) 推荐(0)
摘要: 任务一: coffee_name = ('蓝山', '卡布其尔', '拿铁', '皇家咖啡', '女五咖啡', '美丽与哀愁') print('您好!欢迎光临小(>^ω^<)喵咖啡屋') print('本店经营的咖啡有:') # index获取元组当中的元素索引,item获取元组当中的元素内容 fo 阅读全文
posted @ 2022-08-05 15:50 tuyin 阅读(57) 评论(0) 推荐(0)
摘要: 任务一: # 创建星座的列表 constellation = ['白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座', '水瓶座', '双鱼座'] # 创建性格列表 nature = ['积极乐观', '固执内向', 阅读全文
posted @ 2022-08-05 15:45 tuyin 阅读(53) 评论(0) 推荐(0)
摘要: 任务一: year = [83, 89, 83, 94, 85, 00, 98] print('原列表:', year) for index, value in enumerate(year): # print(index, value) if str(value) != '0': year[ind 阅读全文
posted @ 2022-08-05 15:43 tuyin 阅读(57) 评论(0) 推荐(0)
摘要: 任务一: # 代表了a的ASCII值 x = 97 for _ in range(1, 27): print(chr(x), '➝➝➝➝➝', x) x += 1 print(' ') x = 97 while x< 123: print(chr(x), '➝➝➝➝➝', x) x += 1 任务二 阅读全文
posted @ 2022-08-05 15:41 tuyin 阅读(48) 评论(0) 推荐(0)
摘要: 任务一: # 模拟支付密码的验证 pwd = input('支付宝支付密码:') if pwd.isdigit():# isdigit判断支付密码是否全部为数字 print('支付数据合法') else: print('支付数字不合法,支付密码只能是数据') print(' ') print('支付 阅读全文
posted @ 2022-08-05 15:37 tuyin 阅读(61) 评论(0) 推荐(0)
摘要: 任务一: def fun(): num = int(input("请输入一个十进制的整数:")) print(num, '的二进制数为:', bin(num)) # 第一种写法,使用了个数可变的位置参数 print(str(num)+"的二进制数为:"+bin(num)) # 第二种写法,使用“+” 阅读全文
posted @ 2022-08-05 15:33 tuyin 阅读(61) 评论(0) 推荐(0)
摘要: 任务一: book_name = 'Java程序设计程序' publish = '西安电子科技大学出版社' pub_date = "2019-02-02" price = 56.8 print('▶→→→→→→→→→→→→→→→→→→→◀') print('▷\t\t《', book_name, ' 阅读全文
posted @ 2022-08-05 13:36 tuyin 阅读(27) 评论(0) 推荐(0)
摘要: 任务一: # 一、①使用print方式进行输出(输出的目的地是文件) fp = open('D:/test.txt', 'w') print("奋斗成就更好的你", file=fp) fp.close() 任务二: # ②使用文件读写操作 with open('D:/test1.txt', 'w') 阅读全文
posted @ 2022-08-05 13:30 tuyin 阅读(96) 评论(0) 推荐(0)
摘要: import math class Shape: def __init__(self, name, area, perimeter): self.name = name self.area = area self.perimeter = perimeter def cal_area(self): p 阅读全文
posted @ 2022-08-05 09:14 tuyin 阅读(854) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 10 ··· 13 下一页