Examveda

What will be the output of the following Python code?
class Name:
    def __init__(self, firstName, mi, lastName):
        self.firstName = firstName
        self.mi = mi
        self.lastName = lastName
 
firstName = "John"
name = Name(firstName, 'F', "Smith")
firstName = "Peter"
name.lastName = "Pan"
print(name.firstName, name.lastName)

A. Peter Pan

B. John Pan

C. Peter Smith

D. John Smith

Answer: Option B


This Question Belongs to Python Program >> Strings In Python

Join The Discussion

Related Questions on Strings in Python