Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions password_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import random
import string

def generate_password(length=12):
characters = string.ascii_letters + string.digits + string.punctuation
password = ''.join(random.choice(characters) for _ in range(length))
return password

# Example usage
print("Generated password:", generate_password(16))
53 changes: 34 additions & 19 deletions rock_paper_scissor.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
import random

user_action = input("Enter a choice (rock, paper, scissors): ")

possible_actions = ["rock", "paper", "scissors"]
computer_action = random.choice(possible_actions)
print(f"\nYou chose {user_action}, computer chose {computer_action}.\n")

if user_action == computer_action:
print(f"Both players selected {user_action}. It's a tie!")
elif user_action == "rock":
if computer_action == "scissors":
print("Rock smashes scissors! You win!")
else:
print("Paper covers rock! You lose.")
elif user_action == "paper":
if computer_action == "rock":
print("Paper covers rock! You win!")
else:
print("Scissors cuts paper! You lose.")
elif user_action == "scissors":
if computer_action == "paper":
print("Scissors cuts paper! You win!")


i=0
r=1
while i!=r:
user_action = input("Enter a choice (rock, paper, scissors): ")
computer_action = random.choice(possible_actions)
print(f"\nYou chose {user_action}, computer chose {computer_action}.\n")

if user_action == computer_action:
print(f"Both players selected {user_action}. It's a tie!")
elif user_action == "rock":
if computer_action == "scissors":
print("Rock smashes scissors! You win!")
r=0
else:
print("Paper covers rock! You lose.")
r=0
elif user_action == "paper":
if computer_action == "rock":
print("Paper covers rock! You win!")
r=0
else:
print("Scissors cuts paper! You lose.")
r=0
elif user_action == "scissors":
if computer_action == "paper":
print("Scissors cuts paper! You win!")
r=0
else:
print("Rock smashes scissors! You lose.")
r=0
else:
print("Rock smashes scissors! You lose.")
print("Invalid input!")