+ 16

PYTHON CHALLENGE QUESTION [SOLVED]

class A: def __init__ (self, value): self.a = 1 class B(A): def __init__ (self, value = 2): super.__init__(value) ab = B(8) print(ab.a) This particular python challenge question has an answer of 1 (ie value of a in class A) in the quiz, but on pydroid, it throws this error: TypeError: descriptor '__init__' requires a super object but received a 'int'. What could be the issue here?... 🤔

5th Aug 2020, 3:42 PM
👑 Tchybooxuur!
👑 Tchybooxuur! - avatar
4 odpowiedzi
+ 12
You missed the parentheses in your call to super() super().__init__(value)
5th Aug 2020, 3:50 PM
ChaoticDawg
ChaoticDawg - avatar
+ 5
ChaoticDawg Oh ok... 🤦🏽‍♂️ Thanks men 👍🏼
5th Aug 2020, 4:36 PM
👑 Tchybooxuur!
👑 Tchybooxuur! - avatar
- 1
B
6th Aug 2020, 10:41 PM
Makan Sissoko
Makan Sissoko  - avatar
- 1
a
6th Aug 2020, 10:42 PM
Makan Sissoko
Makan Sissoko  - avatar