New Learner to Python: TypeError: __init__() missing 1 required positional argument: 'x'
Hi all, I have only just started my Python learning journey. I have got the above error message to my code I am trying to write up. For the life of me, I cannot figure out where I am going wrong, would someone be a star and help me out! I'm using Sublime Text and the code is here below. Thank you in advance! class myClass: def __init__(self, x): self.x = x #Returns x. def getX(self): return self.x #Changes x. def setX(self, newX): self.x = newX #Multiplies x by 20 and saved to y #Reduces y by 5 #Prints y def function1(self): self.y = self.x * 20 self.y = - 5 print(y) #prints the result of: number3 not equal to number2 and number1 less than number2 def function2(self): number1 = 12 number2 = 42 number3 = 68 print(number3 != number2 and number1 < number2) #prints a greeting def function3(self): print("Hello there!") #Create an object of our class class1 = myClass() #Change x to the number 5 class1.setX("5") #Call each function class1.function1() class1.function2() class1.function3() Error message: Traceback (most recent call last): File "C:\Users\teams\Downloads\Part 1 (2).py", line 43, in <module> class1 = myClass() TypeError: __init__() missing 1 required positional argument: 'x' [Finished in 111ms]