0% found this document useful (0 votes)
24 views8 pages

pt1 Answer Oops

Oops content

Uploaded by

boyssethu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views8 pages

pt1 Answer Oops

Oops content

Uploaded by

boyssethu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Strong number

sum=0

num=int(input("Enter a number:"))

temp=num

while(num):

i=1

fact=1
rem=num%10
while(i<=rem):
fact=fact*i

i=i+1
sum=sum+fact
num=num//10
if(sum==temp):
print("Given number is a strong number")
else:
print("Given number is not a strong number")
3.amicable number
x=int(input('Enter number 1: '))
y=int(input('Enter number 2: '))
sum1=0
sum2=0
for i in range(1,x):
if x%i==0:
sum1+=i
for j in range(1,y):
if y%j==0:
sum2+=j
if(sum1==y and sum2==x):
print('Amicable!')
else:
print('Not Amicable!')

Output:-
Enter the number:220
Enter the number:284
Amicable!
15 leap year

def find_leap_years(given_year):
count=0
list_of_leap_years=[]

while(count<15):
if(given_year%4==0 or given_year%400==0 and given_year%100==0):
list_of_leap_years.append(given_year)
count=count+1
given_year=given_year+1
return list_of_leap_years

list_of_leap_years=find_leap_years(2000)
print(list_of_leap_years)

Output:-
Next fifteen years are printed
Palindrome
num=int(input("Enter a number:"))
temp=num
rev=0
while(num>0):
dig=num%10
rev=rev*10+dig
num=num//10
if(temp==rev):
print("The number is palindrome!")
else:
print("Not a palindrome!")

Output:-
Enter a number:-12321
The number is palindrome!
Eligibility criteria

class Instructor:
def __init__(self):
self.__instructor_name=name
self.__technology_skill=None
self.__experience=None
self.__avg_feedback=None

def set_instructor_name(self,instructor_name):
self.__instructor_name=instructor_name

def set_technology_skill(self,technology_skill):
technology_skill=[i.lower() for i in technology_skill]
self.__technology_skill=technology_skill

def set_experience(self,experience):
self.__experience=experience

def set_avg_feedback(self,avg_feedback):
self.__avg_feedback=avg_feedback

def get_instructor_name(self):
return self.__instructor_name
def get_technology_skill(self):
return self.__technology_skill

def get_experience(self):
return self.__experience

def get_avg_feedback(self):
return self.__avg_feedback

def check_eligibility(self):
if (self.__experience>3 and self.__avg_feedback>=4.5) or
(self.__experience<=3 and self.__avg_feedback>=4):
return True
else:
return False

def allocate_course(self,technology):
if technology.lower() in self.__technology_skill and self.check_eligibility():

return True
else:
return False
bill amount

class Bill:
def __init__(self,bill_id,patient_name):
self.__patient_name=patient_name
self.__bill_id=bill_id
self.__bill_amount=None

def get_bill_amount(self):
return self.__bill_amount

def get_patient_name(self):
return self.__patient_name

def get_bill_id(self):
return self.__bill_id

def calculate_bill_amount(self,consultation_fees, quantity_list, price_list):


total=0
for i,x in enumerate(quantity_list):
total=quantity_list[i]*price_list[i]+total

self.__bill_amount=consultation_fees+total

You might also like