摘要: 内建函数 help() help(list.append) #显示list的append方法的帮助 input() name=input('please enter your name:') #读取输入,将读取到的数据赋值给指定变量 range() #生成一个列表 dir() #查看对象内所有属性及 阅读全文
posted @ 2023-02-08 16:04 昵称不重要! 阅读(8) 评论(0) 推荐(0)
摘要: import unittestclass TestLegion(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_createlegion(self): self.assertEqual(2,1) 阅读全文
posted @ 2023-02-08 15:43 昵称不重要! 阅读(20) 评论(0) 推荐(0)
摘要: import math #导入math模块 math.floor() #调用math模块中的floor()函数 from math import floor #导入math模块中的floor函数方法 floor() #调用floor()函数 阅读全文
posted @ 2023-02-08 15:24 昵称不重要! 阅读(24) 评论(0) 推荐(0)
摘要: try: x = int(input('Enter the first number: ')) y = int(input('Enter the second number: ')) print(x/y)except ZeroDivisionError: print("输入的数字不能为0") 阅读全文
posted @ 2023-02-08 15:12 昵称不重要! 阅读(18) 评论(0) 推荐(0)
摘要: class CocaCola: formula = ['caffeine','sugar','water','soda'] #类的属性coke_for_me = CocaCola() #类的实例化coke_for_you = CocaCola() #类的实例化print(CocaCola.formu 阅读全文
posted @ 2023-02-08 15:02 昵称不重要! 阅读(25) 评论(0) 推荐(0)
摘要: def account_login(): password = input('Password:') if password == '12345': print('Login success!') else: print('Wrong password or invalid input!') acc 阅读全文
posted @ 2023-02-08 14:12 昵称不重要! 阅读(21) 评论(0) 推荐(0)