Skip to content

Commit 35f1f69

Browse files
committed
Joshua Levy
0 parents  commit 35f1f69

22 files changed

+641
-0
lines changed

Diff for: Affirmations Generator.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
print("********Random affirmations generator********")
2+
print("***This program will display a positive message based on your chosen day***")
3+
print("\n")
4+
name = input("Please enter your name: ")
5+
print("Hi",name,"nice to meet you")
6+
dayOfWeek = input("What is the current day of the week? ")
7+
if dayOfWeek == "Monday" or dayOfWeek == "Tuesday" or dayOfWeek == "Wednesday" or dayOfWeek == "Thursday":
8+
favThings = input(f"Tell me what you usually do on {dayOfWeek}: ")
9+
else:
10+
print("This is not a valid day, please try again")
11+
if dayOfWeek == "Monday":
12+
if favThings == "going out" or favThings == "learning English" or favThings == "going to gym":
13+
print("Well,", name,",",dayOfWeek,"is usually the beginning and,",favThings,"is what you should be doing, carry on")
14+
else:
15+
print("I'm sure on",dayOfWeek,"you can do that, but I can't motivate you on this")
16+
if dayOfWeek == "Tuesday":
17+
if favThings == "visting friends":
18+
print("Awesome!, you should",favThings,"on",dayOfWeek)
19+
20+

Diff for: CLI UI using f strings.py

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
def colorChange(color):
2+
if color=="red":
3+
return ("\033[31m")
4+
elif color=="white":
5+
return ("\033[0m")
6+
elif color=="blue":
7+
return ("\033[34m")
8+
elif color=="yellow":
9+
return ("\033[33m")
10+
elif color == "green":
11+
return ("\033[32m")
12+
elif color == "purple":
13+
return ("\033[35m")
14+
15+
title = f"{colorChange('red')}={colorChange('white')}={colorChange('blue')}= {colorChange('yellow')}Music App {colorChange('blue')}={colorChange('white')}={colorChange('red')}="
16+
17+
print(f" {title:^35}")
18+
print(f"🔥▶️\t{colorChange('white')}Radio Gaga")
19+
print(f"\t{colorChange('yellow')}Queen")
20+
21+
prev = "prev"
22+
next = "next"
23+
pause = "pause"
24+
25+
print(f"{colorChange('white')}{prev:<35}")
26+
print(f"{colorChange('green')}{next:^35}")
27+
print(f"{colorChange('purple')}{pause:>35}")
28+
29+
30+
print()
31+
print()
32+
text = "WELCOME TO"
33+
print(f"{colorChange('white')}{text:^35}")
34+
text = "-- ARMBOOK --"
35+
print(f"{colorChange('blue')}{text:^35}")
36+
text = "Definitely not a rip off"
37+
print(f"{colorChange('yellow')}{text:>35}")
38+
text = "a certain other social"
39+
print(f"{colorChange('yellow')}{text:>35}")
40+
text = "networking site"
41+
print(f"{colorChange('yellow')}{text:>35}")
42+
text = "Honest."
43+
print(f"{colorChange('red')}{text:^35}")
44+
text = "Username: "
45+
username = input(f"{colorChange('white')}{text:^35}")
46+
text = "Password: "
47+
username = input(f"{colorChange('white')}{text:^35}")

Diff for: Chracter Health.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import random
2+
3+
print("⚔️ Character Stats Generator ⚔️")
4+
print()
5+
6+
while True:
7+
def dice(sides):
8+
number = random.randint(1, sides)
9+
return number
10+
def player():
11+
roll1 = dice(6)
12+
roll2 = dice(8)
13+
health = roll1 * roll2
14+
return health
15+
16+
gameHealth = player()
17+
18+
character = input("Enter your character: ")
19+
print("The health of", character, "is", gameHealth, "hp")
20+
ask = input("Would you like to try again? Y or N: ")
21+
if ask == "N":
22+
print("Goodbye")
23+
break
24+
elif ask == "Y":
25+
continue
26+
exit()
27+
28+
29+
30+

Diff for: Function colour text.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import time
2+
def newPrint(colour, word):
3+
if colour== "red":
4+
print("\033[31m", word, sep="", end="")
5+
elif colour == "green":
6+
print("\033[0;32m", word, sep="", end="")
7+
else:
8+
print("\033[0m", word, sep="", end="")
9+
10+
11+
print("Super Subroutine")
12+
print("With my ", end="")
13+
newPrint("red", "new program")
14+
newPrint("reset", " I can just call red('and') ")
15+
newPrint("green", "it will print in red ")
16+

Diff for: Gradebook builder.py

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
print("welcome to the online grade checker")
2+
while True:
3+
ask = input("Please enter the name of the subject: ")
4+
if ask == "Science" or ask == "Maths" or ask == "ICT" or ask == "English":
5+
grade = int(input(f"Please enter your marks obtained in {ask}: "))
6+
if grade >= 90 and grade <= 100:
7+
print(f"Your grade in {ask} is A+")
8+
elif grade >= 80 and grade <= 89:
9+
print(f"Your grade in {ask} is A")
10+
elif grade >= 70 and grade <= 79:
11+
print(f"Your grade in {ask} is B")
12+
elif grade >= 60 and grade <= 69:
13+
print(f"Your grade in {ask} is C")
14+
elif grade >= 50 and grade <= 59:
15+
print(f"Your grade in {ask} is D")
16+
elif grade <= 50:
17+
print(f"Your grade in {ask} is U")
18+
else:
19+
print("Invalid subject entered. Enter valid subject")
20+
repeat = input("Would you like to try again?, enter Y or N: ")
21+
if repeat == "Y":
22+
continue
23+
else:
24+
if repeat == "N":
25+
print("Goodbye")
26+
break

Diff for: Guessing Number game.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import random
2+
print("Guess the Number, you have 3 tries")
3+
number = random.randint(1,10)
4+
count = 0
5+
while count < 3:
6+
askUser = int(input("Enter your best guess: "))
7+
if askUser < number:
8+
count += 1
9+
print("your guess is too low, try again: count(s)", count)
10+
elif askUser > number:
11+
print("your guess is too high, try again: count(s)", count)
12+
count += 1
13+
elif askUser == number:
14+
print("brilliant, you have the right number")
15+
count += 1
16+
exit()

Diff for: IF Nested Statements.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python3 -m pygame.examples.aliens

Diff for: Interactive Maths Table.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
ask = "Y"
2+
counter = 0
3+
while ask == "Y":
4+
print("Interactive Maths table")
5+
number = int(input("Enter your number: "))
6+
for table in range(1, 11):
7+
ask = int(input(f"What is {number} x {table} = ?: "))
8+
multple = number * table
9+
if ask == multple:
10+
counter += 1
11+
print(f"correct answer!, you've got",counter,"points")
12+
else:
13+
print("incorrect answer, 0 points")
14+
else:
15+
ask = input("Would you like to try again? Y or N?: ")
16+
if ask == "Y":
17+
continue
18+
else:
19+
break
20+
print("Goodbye")
21+

Diff for: MP3 Player.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from replit import audio
2+
import os, time
3+
4+
def play():
5+
source = audio.play_file('audio.wav')
6+
source.paused = False
7+
while True:
8+
stop = int(input("Please Press 2 to stop playback: "))
9+
if stop == 2:
10+
source.paused = True
11+
return
12+
else:
13+
continue
14+
15+
16+
while True:
17+
os.system("clear")
18+
print("Welcome to Joshua's MP3 Player 🎵")
19+
time.sleep(2)
20+
userInput = int(input("Press 1 to PLAY and 2 to STOP: "))
21+
if userInput == 1:
22+
play()
23+
elif userInput == 2:
24+
continue

Diff for: Maths table.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ask = "Y"
2+
while ask == "Y":
3+
print("Interactive Maths table")
4+
number = int(input("Enter your number: "))
5+
for table in range(1, 11):
6+
print(number, "x", table, "=", number * table)
7+
else:
8+
ask = input("Would you like to try again? Y or N?: ")
9+
if ask == "Y":
10+
continue
11+
else:
12+
break
13+
print("Goodbye")
14+
15+

Diff for: RPS Round counter.py

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
print("E P I C 🪨 📄 ✂️ B A T T L E ️ 🪨 📄 ✂️")
2+
print()
3+
print("Select R, P or S")
4+
print("")
5+
name1 = input("Enter 1st player name: ")
6+
name2 = input("Enter 2nd player name: ")
7+
player1score = 0
8+
player2score = 0
9+
round = 0
10+
from getpass import getpass as input
11+
again = "yes"
12+
while again == "yes":
13+
round = round + 1
14+
print("")
15+
print("************Round", round,"************")
16+
print("")
17+
player1 = input("1st player, Enter your selection: ")
18+
player2 = input("2nd player, Enter your selection: ")
19+
if player1 == "R":
20+
if player2 == "R":
21+
print("") #add space for result
22+
print("You both smashed each other with 🪨, So its draw!!")
23+
print("")
24+
print(name1, "has", player1score, "points and", name2, "has",player2score,"points")
25+
elif player2 == "P":
26+
print("") #add space for result
27+
print(name1, "🪨 is smothered by", name2, "📄")
28+
player2score = player2score + 1
29+
print(name1, "has", player1score, "points and", name2, "has",player2score,"points")
30+
elif player2 == "S":
31+
print("") #add space for result
32+
print(name1, "🪨 has annihilated ", name2, "✂️")
33+
player1score = player1score + 1
34+
print(name1, "has", player1score, "points and", name2, "has",player2score,"points")
35+
else:
36+
print("") #add space for result
37+
print("Invalid Move!!")
38+
39+
40+
elif player1 == "P":
41+
if player2 == "P":
42+
print("")
43+
print("Two bits of 📄 flap at each other. Dissapointing. Draw!!")
44+
print(name1, "has", player1score, "points and", name2, "has",player2score,"points")
45+
elif player2 == "R":
46+
print("")
47+
print(name2, "🪨 is smothered by", name1, "📄")
48+
player1score = player1score + 1
49+
print(name1, "has", player1score, "points and", name2, "has",player2score,"points")
50+
elif player2 == "S":
51+
print("")
52+
print(name1, "📄 is cut into tiny pieces by", name2, "✂️")
53+
player2score = player2score + 1
54+
print(name1, "has", player1score, "points and", name2, "has",player2score,"points")
55+
else:
56+
print()
57+
print("Invalid Move!!")
58+
59+
60+
elif player1 == "S":
61+
if player2 == "S":
62+
print()
63+
print("Ka-Shing! ✂️ bounce off each other like a dodgy sword fight! Draw!!")
64+
elif player2 == "R":
65+
print()
66+
print("🪨 makes metal-dust out of", name1, "✂️")
67+
elif player2 == "P":
68+
print()
69+
print(name2, "📄 is cut into tiny pieces by", name1, "✂️")
70+
else:
71+
print()
72+
print("Invalid Move!!")
73+
74+
else:
75+
print()
76+
print("Invalid Move!!")
77+
78+
print()
79+
again = input("Do you want to play again: ")
80+
if player1score == 3 or player2score == 3:
81+
print("Max score of 3 achieved, thanks for playing")
82+
exit()
83+
84+
print()
85+
print("See you soon 👋")

Diff for: RPS.py

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
print("E P I C 🪨 📄 ✂️ B A T T L E ️ 🪨 📄 ✂️")
2+
print()
3+
print("Select R, P or S")
4+
name1 = input("Enter 1st player name: ")
5+
name2 = input("Enter 2nd player name: ")
6+
7+
again = "yes"
8+
while again == "yes":
9+
print()
10+
player1 = input("1st player, Enter your selection: ")
11+
player2 = input("2nd player, Enter your selection: ")
12+
13+
if player1 == "R":
14+
if player2 == "R":
15+
print()
16+
print("You both smashed each other with 🪨, So its draw!!")
17+
elif player2 == "P":
18+
print()
19+
print(name1, "🪨 is smothered by", name2, "📄")
20+
elif player2 == "S":
21+
print()
22+
print(name1, "🪨 has annihilated ", name2, "✂️")
23+
else:
24+
print()
25+
print("Invalid Move!!")
26+
27+
28+
elif player1 == "P":
29+
if player2 == "P":
30+
print()
31+
print("Two bits of 📄 flap at each other. Dissapointing. Draw!!")
32+
elif player2 == "R":
33+
print()
34+
print(name2, "🪨 is smothered by", name1, "📄")
35+
elif player2 == "S":
36+
print()
37+
print(name1, "📄 is cut into tiny pieces by", name2, "✂️")
38+
else:
39+
print()
40+
print("Invalid Move!!")
41+
42+
43+
elif player1 == "S":
44+
if player2 == "S":
45+
print()
46+
print("Ka-Shing! ✂️ bounce off each other like a dodgy sword fight! Draw!!")
47+
elif player2 == "R":
48+
print()
49+
print("🪨 makes metal-dust out of", name1, "✂️")
50+
elif player2 == "P":
51+
print()
52+
print(name2, "📄 is cut into tiny pieces by", name1, "✂️")
53+
else:
54+
print()
55+
print("Invalid Move!!")
56+
57+
58+
else:
59+
print()
60+
print("Invalid Move!!")
61+
62+
print()
63+
again = input("Do you want to play again: ")
64+
65+
print()
66+
print("See you soon 👋")

0 commit comments

Comments
 (0)