题库 Python题库 题目列表 class Person(): &nbsp...
单选题
class Person():  
    def __init__(self, name, age):  
        self.name = name  
        self.age = age  
  
    def introduce(self):  
        return f"My name is {self.name} and I am {self.age} years old."  
p = Person("Alice", 30)  
print(p.introduce())


以上Python代码,运行结果是?( )

A.

My name is Alice and I am 30 years old.

B.

My name is Person and I am 30 years old.

C.

My name is Alice and I am 0 years old.

D.

My name is 30 and I am Alice years old.

题目信息
2024年 6月 选择题
-
正确率
0
评论
4
点击