Python-Practices-by-Raihan-Sobhan-sir
Python-Practices-by-Raihan-Sobhan-sir
else:
2. Loan Eligibility Checker: Take user input for income and expenses, then determine if they
savings=income-expenses
if (savings/income)>=.2:
print(f"Since you save 20% or more than that, you are eligible for loan.")
else:
print(f"Since you don’t save that much you are not eligible for the loan.")
else:
3. Age Validator for Retirement: Input age and check if the person is eligible for retirement (e.g.,
if 60<age<115:
print(f'Since your age is {round(age, 1)}, you can are eligible for retire.')
elif 0<age<20:
elif 60>=age>=20:
else:
4. Profit or Loss Calculator: Take cost price and selling price as input and print if there’s a profit,
loss, or no gain.
profit=sell-cost
if profit>0:
elif profit<0:
else:
else:
5. Tax Bracket Finder: Input income and determine the applicable tax rate based on different
brackets.
if income>0:
if income<=350000:
elif income<=450000:
elif income<=850000:
elif income<=1350000:
elif income<=1850000:
elif income>1850000:
else:
6. Odd or Even Number Checker: Input a number and print whether it is odd or even.
if num%2==0:
elif num%2==1:
else:
7. Sum of First N Numbers: Ask for a number and calculate the sum of all numbers from 1 to that
number.
Easy way
total=(n*(n+1))/2
Hard way
i=1
total = 0
while i<=n:
total+=i
i+=1
print(total)
8. Find the Largest Number: Let users enter 5 numbers and print the largest one.
Easy way
numlist=[]
numlist.append(n1)
numlist.append(n2)
numlist.append(n3)
numlist.append(n4)
numlist.append(n5)
Hard way
numlist=[]
max=n1
numlist.append(n1)
numlist.append(n2)
numlist.append(n3)
numlist.append(n4)
numlist.append(n5)
for x in numlist:
if x>= max:
max=x
9. Grade Calculator: Take marks for 3 subjects, calculate the average, and print the corresponding
letter grade.
numlist=[]
numlist.append(a)
numlist.append(e)
numlist.append(m)
if avg>=80:
elif 70<=avg<80:
elif 60<=avg<70:
elif 50<=avg<60:
elif 40<=avg<50:
10. Bank Loan Interest Calculator: Depending on the loan type (e.g., home, car, personal), apply
interest=0
if type == "HOME":
interest = .05
interest = .07
interest = .1
type = type.capitalize()
print(f"On your {type} loan of {amount}, You'll have to pay annual interest
of {intamount}")
else:
print("Wrong Input")
END