Answers for "python declare variables in a class"

4

what is a ython instance

An object belonging to a class. e.g. if you had an Employee class, each 
individual employee would be an instance of the Employee class
Posted by: Guest on August-13-2020
3

class python

class Person:
  def __init__(self, name, age):
    self.name = name
    self.age = age

p1 = Person("John", 36)

p1.age = 40

print(p1.age)
---------------------------------------------------------------
40
Posted by: Guest on October-29-2020

Python Answers by Framework

Browse Popular Code Answers by Language