-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConditional.py
More file actions
164 lines (138 loc) · 4.1 KB
/
Conditional.py
File metadata and controls
164 lines (138 loc) · 4.1 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Check user age group
# user_input = input('Enter your age:\n') # Get input as string
# user_Age = int(user_input) # Convert to integer
user_Age = 20 # Example age, replace with input if needed
if user_Age < 13:
print('Children')
elif user_Age <= 19:
print('Teenager')
elif user_Age <= 59:
print('Adult')
else:
print('Senior')
#########################################################
# Give $2 discount on Wednesday for ticket pricing
age = int(input('Sir, what is your age: '))
day = 'Wednesday'
price = 12 if age >= 18 else 8
if day == 'Wednesday':
price -= 2
print('Ticket price for you is: $', price)
####################################################################
# Grading system
marks = int(input('Your marks: '))
if marks <= 100:
if marks >= 90:
print('A Grade')
elif marks >= 80:
print('B Grade')
elif marks >= 70:
print('C Grade')
elif marks >= 60:
print('D Grade')
else:
print('F')
else:
print('Enter marks between 0 to 100')
#####################################################################
# Banana ripeness check based on color
condition = input('Enter banana color (Green, Yellow, Brown): ')
if condition == 'Green':
print('Banana is unripe')
elif condition == 'Yellow':
print('Banana is ripe')
elif condition == 'Brown':
print('Banana is overripe')
else:
print('Please enter only Green, Yellow, or Brown')
########################################################################
# Suggest activity based on weather
weather = input('Enter weather (Rainy, Sunny, Snowy): ')
if weather == 'Rainy':
print('Read a book')
elif weather == 'Sunny':
print('Go for a walk')
elif weather == 'Snowy':
print('Build a snowman')
else:
print('Enter only Rainy, Sunny, or Snowy')
#########################################################
# Transport mode selection based on distance
distance = int(input('Enter the distance (in km): '))
if distance <= 3:
travel = 'Walk'
elif distance <= 15:
travel = 'Use Bike'
else:
travel = 'Use Car'
print(travel)
###########################
# Coffee order with optional extra shot
order_size = 'Medium'
extra_shot = True
if extra_shot:
coffee = order_size + ' coffee with extra shot'
else:
coffee = order_size + ' coffee'
print(coffee)
###########################
# Check password strength
password = input('Enter your password: ')
password_length = len(password)
if password_length <= 6:
check = 'Weak'
elif password_length <= 10:
check = 'Medium'
else:
check = 'Strong'
print('Password strength:', check)
###########################
# Check if a year is a leap year
year = int(input('Enter the year: '))
if (year % 400 == 0) or (year % 4 == 0 and year % 100 != 0):
print(year, 'is a leap year')
else:
print(year, 'is not a leap year')
#######################################
# Suggest food to animals based on age
dog = True
dog_age = 1
cat = True
cat_age = 4
if dog and dog_age <= 2:
print('Puppy food to dog')
if cat and cat_age <= 5:
print('Senior food to cat')
kattle = True
if kattle:
print('Kettle done! Time to make Chai !')
order = input('Whant You want to Order (cookies , samosa) : ').lower().strip()
if order == "cookies" or order == "samosa" :
print(f"Successfully ordered : {order}")
else:
print('sorry Unavailable we only have cookies , samosa')
size = input("Size of Cup (small , medium , large) ").lower().strip()
if size == "samll":
price = 10
print(f"price is : {price}")
elif size == "medium":
price = 15
print(f"price is : {price}")
elif size == "large":
price = 20
print(f"price is : {price}")
else:
print("invalid cup size")
device_status = input("Device status (active/off) : ")
temperature = int(input("Enter the teamerature : "))
if device_status == "active":
if temperature > 35:
print("high tempertaure altert")
else:
print("temperature is normal")
else:
print("device is offf")
order_amount = int(input("enter order price"))
delivery_fee = 0 if order_amount > 300 else 30
total = order_amount + delivery_fee
print(f"total charges will be : {total}")