赞
踩
a = 100; b = 500; if a > b: print("A大一些"); else: print("B大一些"); import random; print(random.randint(1, 100)); class Cat: @staticmethod def eat(): print("猫吃鱼") def sleep(self): print("猫睡觉") cat = Cat() Cat.eat() cat.eat() cat.sleep() list = ["哈哈", "哈哈哈", "哈哈哈哈", 1, True] # for 变量 in 可以迭代的对象: # pass range(1, 10) str = 'hello' # java 数组: 列表、元祖 for i in str: print(i) def sum_2_num(num1, num2): result = num1 + num2 print("%d + %d = %d" % (num1, num2, result)) sum_2_num(30, 40) class Person: def __init__(self, name, age): self.name = name self.age = age print("孩子被生出来了") def __del__(self): print("人死了") def __str__(self): print("人的生平介绍") p = Person('zhangsan', 19) print(p.age) print(p.name) p.__str__() class Student(Person, Cat): def __init__(self): print("学生出生了"); # stu = Student(); # stu.__str__(); # stu.eat(); # stu.sleep(); try: int('abc') except: print("有异常")'运行a = 100; b = 500; if a > b: print("A大一些"); else: print("B大一些"); import random; print(random.randint(1, 100)); class Cat: @staticmethod def eat(): print("猫吃鱼") def sleep(self): print("猫睡觉") cat = Cat() Cat.eat() cat.eat() cat.sleep() list = ["哈哈", "哈哈哈", "哈哈哈哈", 1, True] # for 变量 in 可以迭代的对象: # pass range(1, 10) str = 'hello' # java 数组: 列表、元祖 for i in str: print(i) def sum_2_num(num1, num2): result = num1 + num2 print("%d + %d = %d" % (num1, num2, result)) sum_2_num(30, 40) class Person: def __init__(self, name, age): self.name = name self.age = age print("孩子被生出来了") def __del__(self): print("人死了") def __str__(self): print("人的生平介绍") p = Person('zhangsan', 19) print(p.age) print(p.name) p.__str__() class Student(Person, Cat): def __init__(self): print("学生出生了"); # stu = Student(); # stu.__str__(); # stu.eat(); # stu.sleep(); try: int('abc') except: print("有异常")
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。