573B; Python | 2019-12-19 03:37:58+01 | SLOC 20
1
import random
2 1
import requests
3
4
for i in range(10):
5
    print(random.randint(1,100),end = "  ")
6
print(" ")
7
class Student(object):
8
    def __init__(self,name,sex,age):
9
        self.name = name
10
        self.sex = sex
11
        self.age = age
12
    def setName(self,name):
13
        self.name = name
14
    def getName(self):
15
        return self.name
16
    def __str__(self):
17
        return "姓名:" + self.name + ";\n" + "性别" + self.sex  + ";\n" + "年龄" + str(self.age)
18
if __name__ == "__main__":
19
    s = Student("李斯","男",29)
20
    s.setName("李明")
21
    print(s.__str__())