题库 Python题库 题目列表 运行以下Python代码,结果是?( )class Person():de...
单选题

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

class Person():

def __init__(self, name, age):
       self.name = name
       self.age = age

def say_hello(self):

print(f"Hello, my name is {self.name}. I am {self.age} years old.")

person1 = Person("Alice", 25)
person2 = Person("Bob", 30)

person1.say_hello()

A.
Hello, my name is Alice. I am 25 years old.
B.
Hello, my name is Bob. I am 30 years old.
C.
Hello, my name is Bob. I am 25 years old.
D.

Hello, my name is Alice. I am 30 years old.

题目信息
2023年 9月 选择题
-
正确率
0
评论
76
点击