Skip to content

Commit 8a4adf5

Browse files
committed
2 Real Life Projects committed, errors present
1 parent fc1c46f commit 8a4adf5

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

Projects/Guess The Number.py

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import random
2+
3+
def guess(x):
4+
random_number = random.randint(1,x)
5+
guess = 0
6+
tries = 0
7+
while guess != random_number:
8+
9+
print("No. of attempts taken: " + str(tries))
10+
guess = int(input(f"Guess a number between 1 and {x}: "))
11+
tries += 1
12+
13+
z = guess - random_number
14+
print("\033c\033[3J", end='') #For clearing the console
15+
if z > 500:
16+
print("Woah too high, try going much lower")
17+
elif z > 250:
18+
print("Quite high, try going more lower")
19+
elif z > 125:
20+
print("That's high, try going lower")
21+
elif z > 63:
22+
print("That's a bit high, try going lower")
23+
elif z > 30:
24+
print("Almost there, go lower")
25+
elif z > 15:
26+
print("Almost there, slowly go lower")
27+
elif z > 7:
28+
print("That's so close, decrease it a bit")
29+
elif z > 3:
30+
print("Super Close! Carefully decrease it")
31+
elif z < -500:
32+
print("Woah too low, try going much higher")
33+
elif z < -250:
34+
print("Quite low, try going more higher")
35+
elif z < -125:
36+
print("That's low, try going higher")
37+
elif z < -63:
38+
print("That's a bit low, try going higher")
39+
elif z < -30:
40+
print("Almost there, go higher")
41+
elif z < -15:
42+
print("Almost there, slowly go higher")
43+
elif z < -7:
44+
print("That's so close, increase it a bit")
45+
elif z < -3:
46+
print("Super Close! Carefully infc it")
47+
print("\033c\033[3J", end='') #for clearing the console
48+
print("You Did It!!! The correct answer is " + str(random_number)) #This statement doesn't get printed idk how to not let it get cleared
49+
50+
#After correct answer it goes back into the while loop which shouldn't happen.
51+
52+
guess(1000)

Projects/Mad Libs.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'''
2+
It's me Ahmed Baari again! I created this simple madlibs project for python beginners
3+
'''
4+
5+
a = input("The year right now: ")
6+
b = input("The name of your country: ")
7+
c = input("The name of your school: ")
8+
d = input("The reporting time of your school: ")
9+
e = input("The dispersal time of your school: ")
10+
f = input("The number of working days in your school per weeek: ")
11+
g = input("The duration of each period/class: ")
12+
h = input("The average no. of hours you study at home every day: ")
13+
i = input("How stressed are you due to all this: ")
14+
j = input("Your name: ")
15+
16+
17+
18+
print("During the year " + a + " some expert researchers from " + b + " researched on students from " + c + " school to find out the impact of studies on their mental health. This year long researched found the nation a lot of new facts.\n\nTHE REPORT\n Students said that they had to reach school by " + d + " and disperse at " + e + " everyday for " + f + " days a week. Each period lasted " + g + " minutes long. Students told that they study for " + h + " hours in a day. When asked about how stressed the students were, a student said \"" + i + "\". The research project was lead by " + j + " .")

0 commit comments

Comments
 (0)