Skip to content

Commit b59ebcb

Browse files
authored
Add files via upload
1 parent 48a600a commit b59ebcb

4 files changed

Lines changed: 56 additions & 0 deletions

File tree

codes_in_JULY2025/compare.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# l = [7, 8, 6, 4, 5]
2+
# l.sort()
3+
# print(f"Sorted list: {l}")
4+
5+
k = []
6+
n1 = int(input("Enter the number 1: "))
7+
k.append(n1)
8+
n2 = int(input("Enter the number: "))
9+
k.append(n2)
10+
n3 = int(input("Enter the number: "))
11+
k.append(n3)
12+
n4 = int(input("Enter the number: "))
13+
k.append(n4)
14+
15+
k.sort()
16+
print(f"Greatest number entered is: {k[-1]}")

codes_in_JULY2025/pass_fail.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
marks1 = int(input("Enter mark of Maths : "))
2+
marks2 = int(input("Enter mark of Physics : "))
3+
marks3 = int(input("Enter mark of Chemistry : "))
4+
5+
total_percentage = 100*(marks1 + marks2 + marks3)/300
6+
7+
if (total_percentage >= 40 and marks1 >= 33 and marks2 >= 33 and marks3 >= 33):
8+
print("You have passed the exam with a percentage of", total_percentage)
9+
else:
10+
print("You have failed the exam with a percentage of", total_percentage)
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#take user name and greets them according to day time
2+
import datetime as dt
3+
c = dt.datetime.now()
4+
h = c.hour
5+
6+
x = input("Enter your name:")
7+
8+
if h >= 4 and h <= 11:
9+
print(f"Good morning, {x}!")
10+
elif h >11 and h <= 16:
11+
print(f"good afternoon, {x}!")
12+
elif h > 16 and h <= 20:
13+
print(f"Good evening, {x}!")
14+
elif h > 20 or h < 4:
15+
print(f"Good night, {x}!")
16+
else:
17+
print(f"Hello, {x}!")
18+
19+

codes_in_JULY2025/while_loops.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#iterate contents of loop using while loop taking inputs from user
2+
# l = ["Parz1", "Game","KEY","Stone","Random"]
3+
l = []
4+
x1 = input("Enter a list of items separated by commas: ")
5+
l = x1.split(',')
6+
7+
x = 0
8+
while x < len(l):
9+
print(f"Entered at index: {x} item in list is: {l[x]}")
10+
x += 1
11+

0 commit comments

Comments
 (0)