Why I can't assign variables with constructor and get the wrong value from it?

Advertisements I would like to implement a BST in C++, but I found that the integer variable "val" I pass in the constructor "Node()" seem not to work properly. P.S. I am a totally newbie to this language, and here is my code #include<iostream> using namespace std; class Node{ public: int val; Node *left; Node… Read More Why I can't assign variables with constructor and get the wrong value from it?

python class method invocation missing 1 required positional argument

Advertisements I created class method to easen file reading. But the end result gives me error of file_read=Read_file.file_reading_through_class(‘./ConfigurationFile/configFile.csv’) TypeError: Read_file.file_reading_through_class() missing 1 required positional argument: ‘fileName’ the code is below; import pandas as pd import sys,os, time,re class Read_file(): def file_reading_through_class(self,fileName): if getattr(sys, ‘frozen’, False) and hasattr(sys, ‘_MEIPASS’): path_actual = os.getcwd() path_main_folder = path_actual[:-4] path_result… Read More python class method invocation missing 1 required positional argument

How do i make a light dark specific css tag?

Advertisements Light Dark Css body.light + .mat-medium { background: rgba(246,246,246,0.60); backdrop-filter: blur(30px) saturate(1); } <body class="light"> <div class="mat-medium"></div> </body> I was hoping that the div would display the mat-medium class because the body had the class light but it displayed a blank div. View the repl. >Solution : You need to fix your selector to… Read More How do i make a light dark specific css tag?

fraction class in java

Advertisements I created a fraction Java class but it gives wrong results. Sometimes it gives good answers and sometimes bad or maybe it doesn’t give any results just random digits? Any help or hints are welcome import java.util.Scanner; public class Ulamek{ public static void main(String[] args){ Scanner input = new Scanner(System.in); System.out.println("Podaj licznik i mianownik… Read More fraction class in java

How to make a class where one attribute is a generated list of the attributes of another list in the class?

Advertisements I have a class of prices in a store. It does not accept price_range as an input but I want it to produce a list of all the prices of the products for itself. { "mall": [ { "store_id": 1, "price_range": [], "products": [ { "product_id": 1, "price": 9.99 } ] }, { "store_id":… Read More How to make a class where one attribute is a generated list of the attributes of another list in the class?

Why can I set properties during instantiation through __init__, but not through another method?

Advertisements This is working class a: def __init__(self,ka,sif): self.ka = ka self.sif = sif def b(self): pass c = a("d","e") c print(c.ka,c.sif) but This is not working class a: def __init__(self): pass def b(self,ka,sif): self.ka = ka self.sif = sif c = a().b("d","e") c print(c.ka,c.sif) Why? I expected the get same result. Why these are… Read More Why can I set properties during instantiation through __init__, but not through another method?

Flutter Class Auth error; When I'm creating this class I'm experiencing undefined class error

Advertisements I was creating a class but I’m experiencing error as below. I do not understand I’m experiencing this error. I’ve added picture to see the error visually. import ‘package:firebase_auth/firebase_auth.dart’; Class Auth { final FirebaseAuth firebaseAuth = FirebaseAuth.instance; User? get currentUser => firebaseAuth.currentUser; Stream<User?> get authStateChanges => firebaseAuth.authStateChanges(); Future<void> signIn({ required String email, required String… Read More Flutter Class Auth error; When I'm creating this class I'm experiencing undefined class error

Class1 inside Class: Error: Page1.__init__.My_Data.__init__() got an unexpected keyword argument 'Name'

Advertisements When i try to start my script, i get a error. I have main class Page1 and inside is My_Data class and function1 function. The error is: TypeError: Page1.__init__.<locals>.My_Data.__init__() got an unexpected keyword argument ‘Name’ MyCode.py: class Page1(tk.Frame): def __init__(self, master, other, **kw): super().__init__(master, **kw) self.configure(bg=’white’) class My_Data(): def __init__(self): self.Name: str self.Year: float… Read More Class1 inside Class: Error: Page1.__init__.My_Data.__init__() got an unexpected keyword argument 'Name'