-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path8th.py
More file actions
59 lines (46 loc) · 2.32 KB
/
Copy path8th.py
File metadata and controls
59 lines (46 loc) · 2.32 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
# Temperature Converter and Weather Check
# Take temperature input in Celsius as a string, convert it to float, and convert it to Fahrenheit using arithmetic operators.
# Using comparison and logical operators, print whether the weather is cold (≤ 15), pleasant (16–30), or hot (> 30).
# Also print both Celsius and Fahrenheit values
# temprature=float(input('enter current temprature '))
# Fahrenheit=temprature*(9/5)+32
# print('temptature is:',Fahrenheit,'fahrenheit')
# if temprature<=15:
# print('weather is cold')
# elif (temprature>15) and (temprature<=30):
# print('weather is pleasant')
# else:
# print('weather is hot')
# Password Strength Checker
# Ask the user to input password length (integer) and whether it contains special characters ("yes"/"no").
# Using logical and comparison operators, determine if password is Strong (length ≥ 8 and has special characters),
# Medium (length ≥ 6 or has special characters), or Weak otherwise. Print the strength category
# Profit or Loss with Percentage
# Ask the user to input cost price and selling price (floats).
# Calculate profit or loss amount and percentage using arithmetic operators.
# Using comparison operators, print whether it is profit, loss, or no profit-no loss.
# Also check logically if profit percentage is more than 20% and print a message "High Profit" if true.
# cp=float(input('enter cost price: '))
# sp=float(input('enter selling price: '))
# percent=round((sp-cp)/cp*100, 2)
# if sp>cp:
# print('profit percent is',percent,'%')
# elif cp>sp:
# print('loss percent is ',percent,'%')
# else:
# print('no profit or loss')
# Attendance Eligibility for Exam
# Take total classes and attended classes as integers.
# Calculate attendance percentage.
# Using comparison and logical operators, check if attendance is at least 75% and the student
# does not have any medical leave flag set to "no" or "yes". If attendance < 75 but medical leave is "yes", still allow.
# Print eligibility and attendance percentage.
totalClass=int(input('enter total class: '))
attendedClasses=int(input('enter total classes:'))
medicalLeave=input('enter medical leave (yes/no): ')
percentage=(attendedClasses/totalClass)*100
print(round(percentage),2)
if (percentage<75) and (medicalLeave=='yes'):
print('eligible for exam')
else:
print('not eligible for exam')