-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7th.py
More file actions
132 lines (97 loc) · 4 KB
/
Copy path7th.py
File metadata and controls
132 lines (97 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Student Percentage and Pass/Fail Decision
# Take marks of three subjects as input (in string form). Convert them into integers, calculate total and percentage using arithmetic operators.
# Using comparison and logical operators, print whether the student has:
# * Passed (percentage ≥ 40 *and* each subject mark ≥ 33)
# * Failed otherwise
# Also print the percentage.
# sub1=int(input('marks of subject 1= '))
# sub2=int(input('marks of subject 2= '))
# sub3=int(input('marks of subject 3= '))
# marks=sub1+sub2+sub3
# percentage=round(marks/300*100, 2)
# print(percentage)
# if (percentage>=40) and (sub1>=33) and (sub2>=33) and (sub3>=33):
# print('Passed')
# else:
# print('Failed')
# BMI Category Checker
# Ask the user to input their weight (kg) and height (meters). Convert inputs to floats and calculate BMI using the formula:
# BMI = weight / (height * height)
# Using comparison and logical operators, print whether the person is:
# * Underweight (BMI < 18.5)
# * Normal (BMI between 18.5 and 24.9)
# * Overweight (BMI ≥ 25)
# Also print the calculated BMI.
# height=float(input('what is your height= '))
# weight=float(input('what is your weight= '))
# BMI=weight/(height*height)
# print(BMI)
# if BMI<18.5:
# print('Underweight')
# elif (BMI>=18.5) and (BMI<=24.9):
# print('Normal')
# else:
# print('Overweight')
# Loan Eligibility
# Ask the user to input their monthly income and age. Convert to integers.
# Using arithmetic, comparison, and logical operators determine if the user is eligible for a loan:
# Conditions:
# * Age between 21 and 60
# * Income greater than or equal to 25000
# Print whether the person is eligible or not.
# monthlyIncome=int(input('what is your monthly income= '))
# age=int(input('what is your age= '))
# if (monthlyIncome>=25000) and (age>=20) and (age<=60):
# print('you are eligible for loan')
# else:
# print('you are not eligible for loan')
# Salary Hike and Tax Check
# Ask the user to enter their current salary (float) and performance rating (out of 5).
# If rating is greater than or equal to 4 and salary is less than 80000, increase salary by 15%; otherwise increase by 5%.
# Then check using comparison and logical operators whether the new salary is taxable (greater than 50000).
# Print old salary, new salary, and taxability status.
# salary=float(input('enter your salary= '))
# performanceRating=int(input('enter your performance rating= '))
# if (performanceRating>=4) and (salary<=80000):
# newSalary=((salary*0.15)+salary)
# else:
# newSalary=((salary*0.05)+salary)
# print('old salary=', salary)
# print('new salary=', newSalary)
# if newSalary>=50000:
# print('taxable')
# else:
# print('non taxable')
# Voting Booth Validator
# Take age and city name as input. Convert age to integer.
# Using logical operators, verify that the person is at least 18 and does not live in a restricted city named "TestCity".
# Print whether they can vote in the local booth. Also print how many years are left if they are underage (use arithmetic operator).
# age=int(input('enter your age '))
# city=input('enter your city ')
# if (age>=18) and (city!='textcity'):
# print('you are eliguble to vote in local booth')
# if age<18:
# print('year left for votting', 18-age)
# else:
# print('you are not eligible to vote in local booth')
# Triangle Type Finder
# Take input and convert to float
# Check if a valid triangle can be formed
# Calculate perimeter
# Determine the type of triangle
# a = float(input("Enter first side: "))
# b = float(input("Enter second side: "))
# c = float(input("Enter third side: "))
# if (a + b > c) and (a + c > b) and (b + c > a):
# perimeter = a + b + c
# if a == b == c:
# triangle_type = "Equilateral"
# elif a == b or b == c or a == c:
# triangle_type = "Isosceles"
# else:
# triangle_type = "Scalene"
# print("Valid Triangle")
# print("Triangle Type:", triangle_type)
# print("Perimeter:", perimeter)
# else:
# print("Invalid Triangle")