- 2
python3 super fuction arguments
hi i discover that the super funciton takes some optional argument but can someone explain to me what super function does if the areguments are exist ?
16 Answers
+ 1
Or you can go to the genuine doco; always worth checking. It is possible for a class to inherit from multiple classes, and the optional arguments let you choose between them.
https://docs.python.org/3/library/functions.html?highlight=super#super
+ 4
0MR4N , it doesn't always need to be self. If you are wanting to call a method from a parent class of one of your class' objects, you would specify that object instead of self.
Another possibility is that you are importing a class from a library, and it has a private parent class that you don't want to import. If you wanted to access a class or static method from that private parent, you would put the class you have imported in that second argument, fitting the "or type" definition for the argument.
+ 2
Here's a pretty good explanation of super()
https://realpython.com/JUMP_LINK__&&__python__&&__JUMP_LINK-super/
+ 2
0MR4N
If you had thoroughly read the link I provided you'd have already known the answer. 😉
+ 2
help me
def balanced(expression):
#your code goes here
print(balanced(input()))
Balanced Parentheses
Parentheses are balanced, if all opening parentheses have their corresponding closing parentheses.
Given an expression as input, we need to find out whether the parentheses are balanced or not.
For example, "(x+y)*(z-2*(6))" is balanced, while "7-(3(2*9))4) (1" is not balanced.
The problem can be solved using a stack.
Push each opening parenthesis to the stack and pop the last inserted opening parenthesis whenever a closing parenthesis is encountered.
If the closing bracket does not correspond to the opening bracket, then stop and say that the brackets are not balanced.
Also, after checking all the parentheses, we need to check the stack to be empty -- if it's not empty, then the parentheses are not balanced.
Implement the balanced() function to return True if the parentheses in the given expression are balanced, and False if not.
Sample Input:
(a( ) eee) )
Sample Output:
False
+ 1
ChaoticDawg yaaah i did 😆 but u knoooow i am hardhead
0
Myk Dowling but sorry i knw now wht it does but what meas the second argumenet exactly and why it always need to be "self".
0
Myk Dowling ok thank u so much i understand now
0
why
10.1*6 = 60.599999999999994
10.1*3 = 30.299999999999997
0
Mostrar preguntas print ("chupones")
0
Opino que el mejor es python 3
0
Aún me cuesta crear code, ahí que dedicar mucho tiempo
0
Alimontriks
0
Make an algorithm that reads several numbers and tells you how many of those numbers
between 100 and 200 were entered. When the value 0 (zero) is read, the algorithm
must cease its execution. (someone answer
0
Hii
0
ฉันอยากทำหน้าเว็บที่เชื่อมโยงไปยังการชำระเงินด้วยคิวอาร์โค้ดได้ ผ่านระบบไพท็อน ช่วยทำสคริปที่ใช้ในการติดตั้งให้ฉันหน่อย ฉันพยายามหลายครั้งแล้ว แต่ฉันทำไม่สำเร็จ แบบคิวอาร์โค้ดของฉัน ฉันใส่มันไว้ในแฟ้มด้านล่างนี้
I want to make a web page that can link to QR code payments. Through the Python system Please help me with the installation script. I've tried many times. But I didn't succeed. My QR code model I put it in the file below.
https://drive.google.com/drive/folders/1ytomUZ2I57GfC6uwYFBxsr7ItWk_2r6W