d={"Name":'xxx'} d["Sex"]="male" d["name"]="yyy" print(d) 结果是
举一反三
- def f():st["name"]="x"st={"name":"a","sex":"male"}f()print(st["name"],st["sex"])结果是 A: male B: a male C: x None D: x male
- def f(): st["name"]="x" st={"name":"a","sex":"male"} f() print(st["name"],st["sex"]) 结果是
- def f():st["name"]="x"st={"name":"a","sex":"male"}f()print(st["name"],st["sex"])以上代码运行结果是 A: x male B: a male C: 错误 D: 没有错误,也没有输出
- style="padding-left:0px;">class Student: name="xxx" @staticmethod def show(): name="yyy" print(name,Student.name) @staticmethod def display(): show() s=Student() s.display() 结果:
- 下面程序的运行结果是( )。class Student:name="yyy"age=30def __init__(self):self.name="xxx"self.age=20s=Student()Student.name="zzz"print(s.name,s.age,Student.name,Student.age) A: yyy 20 zzz 30 B: xxx 20 zzz 30 C: yyy 20 xxx 30 D: xxx 20 yyy 30