Home > OS >  invalid literal for int() with base 10 while using vscode
invalid literal for int() with base 10 while using vscode

Time:12-08

Getting invalid literal for int() with base 10 with python code while running on vs code?

class Car:
    def setName(self,name):
        self.name=name
    def getName(self):
        return self.name
Honda=Car()
carname=input()
Honda.setName()
print(Honda.getName())

CodePudding user response:

Honda.setName() to Honda.setName(carname)

class Car:
    def setName(self, name):
        self.name = name

    def getName(self):
        return self.name


Honda = Car()
carname = input("Car name: ")
Honda.setName(carname)
print(Honda.getName())

CodePudding user response:

Why are you asking this?Try google…

  • Related