Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What would be the result of running the code below? class Parent: An arbitrary class num 1 : int

What would be the result of running the code below?
class Parent:
"""An arbitrary class
"""
num1: int
def __init__(self, num1: int)-> None:
self.num1= num1
class Child(Parent):
"""A subclass.
"""
num2: int
def __init__(self, num1: int, num2: int)-> None:
self.num2= num2
if __name__=='__main__':
c = Child(1,2)
print(c.num2)
print(c.num1)
Group of answer choices
2
0
2
Traceback (most recent call last):
...
AttributeError ...
2
1
Traceback (most recent call last):
...
AttributeError ...

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

=+a. Consumer-Focused show benefits.

Answered: 1 week ago