Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren+ 1
Python code
Hello, I want to write a code that works with the class and is related to the management of a school
2 Antworten
+ 1
#this code gonna create some classes (without methods sadly) yet you will get some important points out of it, enjoy
#just copy and paste it into your python IDE
class Teacher():
def __init__(self, name, age, gender, subject):
self.name = name
self.age = age
self.gender = gender
self.subject = subject
class Student():
def __init__(self, name, age, gender,taken_subjects):
self.name = name
self.age = age
self.gender = gender
self.taken_subjects = taken_subjects
teacher1=Teacher("Ali", 25, "male", "programing")
student1=Student("somename", 12,"male", "math and some other subjects ")
print (teacher1.name)
print(f"{student1.name} studies {student1.taken_subjects}")
+ 1
your question is not enough, and needs a lot of extra details, yet i am ganna try helping you out....