In [2]:
student = input("Student Name: ")
In [3]:
car = input("Car name: ")
In [4]:
Total_marks = input("Total marks: ")
In [5]:
Patient_Name = input("Patient Name: ")
In [6]:
height_inches = input("height_inches: ")
In [7]:
weight_pounds = input("weight_pounds: ")
In [8]:
print("NMHU")
print("CS")
In [9]:
# print in a signle line
print("NMHU",end = ' ')
print("CS")
In [10]:
print("University: NMHU")
print("Department: CS")
In [11]:
print("University: NMHU" ,end = ' ')
print("Department: CS")
In [12]:
class PatientData:
    def __init__(self):
        self.name = ""
        self.height_inches =0
        self.weight_pounds =0
        
patient = PatientData()  # object
Patient_Name = input("Patient Name: ")
print("\nPatient Data(before):")
print(patient.height_inches ,"in: ",end = " ")
print(patient.weight_pounds,"lbs: ")
print("\nPatient Data(after):")
patient.height_inches=input("height_inches: ")
patient.weight_pounds= input("weight_pounds:")
print(patient.height_inches ,"in: ",end = " ")
print(patient.weight_pounds,"lbs: ")
In [13]:
class PatientData:
    def __init__(self):
        self.name = ""
        self.height_inches =0
        self.weight_pounds =0
        
print("========= information of patient_1 ==============================")        
patient = PatientData()  # object
Patient_Name = input("Patient Name: ")
print("\nPatient Data(before):")
print(patient.height_inches ,"in: ",end = " ")
print(patient.weight_pounds,"lbs: ")
print("\nPatient Data(after):")
patient.height_inches=input("height_inches: ")
patient.weight_pounds= input("weight_pounds:")
print(patient.height_inches ,"in: ",end = " ")
print(patient.weight_pounds,"lbs: ")
print("\n========= information of patient_2 ==============================") 
patient2 = PatientData()  # object
Patient_Name = input("Patient Name: ")
print("\nPatient Data(before):")
print(patient2.height_inches ,"in: ",end = " ")
print(patient2.weight_pounds,"lbs: ")
print("\nPatient Data(after):")
patient2.height_inches=input("height_inches: ")
patient2.weight_pounds= input("weight_pounds:")
print(patient2.height_inches ,"in: ",end = " ")
print(patient2.weight_pounds,"lbs: ")
In [14]:
class Employee:
    def __init__(self,name,wage,hours):
        self.name = name 
        self.wage = wage
        self.hours = hours
        
    def calculate_pay(self):
        return self.wage*self.hours
    
zain = Employee("Zain",8.25,20)
zain.calculate_pay()
print("Zain:\n Net Pay:",zain.calculate_pay())
zain = Employee("Khizar",8.25,20)
zain.calculate_pay()
print("\nKhizar:\n Net Pay:",zain.calculate_pay())
zain = Employee("Hira",12.50,40)
zain.calculate_pay()
print("\nHira:\n Net Pay:",zain.calculate_pay())
Mike = Employee("Mike",14.50,40)
zain.calculate_pay()
print("\nMike:\n Net Pay:",zain.calculate_pay())
In [15]:
class Person:
    def set_details(self,name,age):
        self.name = name
        self.age = age
        
        
    def information(self):
        print(self.name,self.age)
        
    def display(self): 
        print("I am a student and my name is",self.name,"and my age is ",self.age)
        
    def greet(self):
        if self.age <50:
            print("Hello,how are you doing")
        else:
            print("Hello,how are you")
        
p1 = Person()
p2= Person()
print("=============information of 1st person=================")
p1.set_details("Mike",15)
print(p1.name)
print(p1.age)
p1.information()
p1.display()
p1.greet()
print("\n==============information of 2nd person===============================")
p2.set_details("Mariam",54)
print(p2.name)
print(p2.age)
p2.information()
p2.display()
p2.greet()
In [ ]:
fall21  09-14-21
In [ ]:
 
In [ ]:
 
In [ ]:
s21 03-22-21
In [1]:
class Movie:
    def __init__(self,title,director,writer):
        self.title = title
        self.director = director
        self.writer = writer
        
    def info(self):
        print("Movie Name: ",self.title)
        print("director name: ",self.director)
        print("Writer name: ",self.writer)
        
list_of_movies = []
while True:
    title = input("Enter Movie Name: ")
    director =input("Enter director name: ")
    writer = input("Enter Writer name: ")
    m = Movie(title,director,writer)
    list_of_movies.append(m)
    print("movies added successfully")
    option =input("\nDo you want to add one more movie [Yes|No]: ")
    if option== "No":
        break
 
No comments:
Post a Comment