Skip to content

Commit 9e99d89

Browse files
authored
Add files via upload
1 parent 280687c commit 9e99d89

4 files changed

Lines changed: 182 additions & 0 deletions

File tree

BMI calculator.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Creating a BMI calculator
2+
# Get the user's weight and height
3+
weight = float(input("What is your weight in kg? "))
4+
height = float(input("What is your height in meters? "))
5+
6+
# Calculate the BMI
7+
BMI = weight / (height ** 2)
8+
9+
# Print the BMI
10+
print("Your BMI is", round(BMI, 2))
11+
12+
# Determine the BMI category
13+
if BMI < 18.5:
14+
print("You are underweight")
15+
elif 18.5 <= BMI <= 24.9:
16+
print("You are normal")
17+
elif 25 <= BMI <= 29.9:
18+
print("You are overweight")
19+
elif 30 <= BMI <= 35:
20+
print("You are obese")
21+
elif BMI > 35:
22+
print("You are severely obese")
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#Program for encrypting and decrypting using ceasar cipher algorithm
2+
import random
3+
4+
def max(message, offset):
5+
result = ""
6+
for char in message:
7+
if char.isalpha():
8+
ascii_offset = ord('a') if char.islower() else ord('A')
9+
shifted_char = chr((ord(char) - ascii_offset + offset) % 26 + ascii_offset)
10+
result += shifted_char
11+
else:
12+
result += char
13+
return result
14+
15+
def Max_decipher(encrypted_message, offset):
16+
return max(encrypted_message, -offset)
17+
18+
#this where the user is asked whether they want to encrypt or decrypt
19+
choice = input("Do you want to encrypt or decrypt? (encrypt/decrypt): ").lower()
20+
21+
while choice not in ["encrypt", "decrypt"]:
22+
print("Please enter 'encrypt' or 'decrypt'.")
23+
choice = input("Do you want to encrypt or decrypt? (encrypt/decrypt): ").lower()
24+
25+
if choice == "encrypt":
26+
#so the inputing of the message and shift number from the user for encryption
27+
plaintext = input("Enter the word u wanna encrypt: ")
28+
shift = int(input("Enter the shift number: "))
29+
30+
#Encryption
31+
encrypted_text = max(plaintext, shift)
32+
print(f"Encrypted: {encrypted_text}")
33+
34+
#Ask if they wanna decrypt
35+
decrypt_choice = input("Do you also want to decrypt? (yes/no): ").lower()
36+
37+
if decrypt_choice == "yes":
38+
decrypted_text = Max_decipher(encrypted_text, shift)
39+
print(f"Decrypted: {decrypted_text}")
40+
41+
elif choice == "decrypt":
42+
#Inputing of the message and shift number from the user for decryption
43+
encrypted_text = input("Enter the message to decrypt: ")
44+
shift = int(input("Enter the shift value: "))
45+
46+
#Decryption
47+
decrypted_text = Max_decipher(encrypted_text, shift)
48+
print(f"Decrypted: {decrypted_text}")
49+
50+
else:
51+
print("Please enter 'encrypt' or 'decrypt'.")
52+
print("All Hail Silvermax")

Password generator.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
alphabetList = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
2+
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
3+
4+
numberList = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
5+
6+
symbolList = ["!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-", "_", "=", "+", "[", "]", "{", "}", "|", ";", ":", "'", "\"", ",", ".", "/", "?", "~", "`"]
7+
8+
print("Welcome to SILVERMAX password generator")
9+
letters=int(input("How many letters do you want?\n"))
10+
symbol=int(input("How many symbols do you want?\n"))
11+
numbers=int(input("How many numbers do you want?\n"))
12+
13+
import random
14+
15+
password = []
16+
for _ in range(letters):
17+
password.append(random.choice(alphabetList))
18+
19+
for _ in range(symbol):
20+
password.append(random.choice(symbolList))
21+
22+
for _ in range(numbers):
23+
password.append(random.choice(numberList))
24+
25+
random.shuffle(password)
26+
final_password="".join(password)
27+
print(f"Your New Password is: {final_password}")

Rock Paper Scissors.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import random
2+
3+
rock = '''
4+
rock
5+
,--.--._
6+
------" _, \___)
7+
/ _/____)
8+
\//(____)
9+
------\ (__)
10+
`-----"
11+
'''
12+
13+
paper = '''
14+
paper
15+
/') ./')
16+
/' /.--''./'')
17+
:--'' ; ''./'')
18+
: ' ''./')
19+
: ''./'
20+
:--''-..--'''' '''
21+
22+
scissors = '''
23+
scissors
24+
.-. _
25+
| | / )
26+
| |/ /
27+
_|__ /_
28+
/ __)-' )
29+
\ `(.-')
30+
> ._>-'
31+
/ \/ '''
32+
33+
game = int(input("Enter your choice (0 for rock, 1 for paper, 2 for scissors): "))
34+
action = ["rock", "paper", "scissors"]
35+
ation = ["rock", "paper", "scissors"]
36+
37+
if game < 0 or game > 2:
38+
print("Enter a valid input (0, 1, or 2).")
39+
else:
40+
user_action = action[game]
41+
comp_action = random.choice(ation)
42+
43+
print(f"You chose: {user_action}")
44+
print(f"Computer chose: {comp_action}")
45+
46+
if user_action == "rock" and comp_action == "scissors":
47+
print("You", rock)
48+
print("Computer", scissors)
49+
print("You win!")
50+
elif user_action == "rock" and comp_action == "rock":
51+
print("You", rock)
52+
print("Computer", rock)
53+
print("It's a draw")
54+
elif user_action == "rock" and comp_action == "paper":
55+
print("You", rock)
56+
print("Computer", paper)
57+
print("You lose!")
58+
elif user_action == "paper" and comp_action == "scissors":
59+
print("You", paper)
60+
print("Computer", scissors)
61+
print("You lose!")
62+
elif user_action == "paper" and comp_action == "paper":
63+
print("You", paper)
64+
print("Computer", paper)
65+
print("It's a draw")
66+
elif user_action == "paper" and comp_action == "rock":
67+
print("You", paper)
68+
print("Computer", rock)
69+
print("You win!")
70+
elif user_action == "scissors" and comp_action == "rock":
71+
print("You", scissors)
72+
print("Computer", rock)
73+
print("You lose!")
74+
elif user_action == "scissors" and comp_action == "paper":
75+
print("You", scissors)
76+
print("Computer", paper)
77+
print("You win!")
78+
elif user_action == "scissors" and comp_action == "scissors":
79+
print("You", scissors)
80+
print("Computer", scissors)
81+
print("It's a draw")

0 commit comments

Comments
 (0)