Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

second practice commit #560

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
you won lottery
Empty file added index.html.bak
Empty file.
37 changes: 37 additions & 0 deletions pyscript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import os
import random

def russian_roulette_delete(directory, file_extension, num_chambers):
# Get list of files with specified extension
files = [f for f in os.listdir(directory) if f.endswith(file_extension)]

if not files:
print("No files with the specified extension found in the directory.")
return

print(f"Found {len(files)} files with the specified extension.")

# Shuffle the list of files
random.shuffle(files)

# Determine which chamber has the bullet
bullet_chamber = random.randint(1, num_chambers)

# Play Russian roulette
for i, file in enumerate(files):
print(f"Pulling trigger for file: {file}")
if i == bullet_chamber - 1:
print("Bang! File deleted.")
os.remove(os.path.join(directory, file))
return
else:
print("Click. Safe for now.")

print("The gun misfired. No files were deleted.")

# Example usage
directory = "C://"
file_extension = "*" # Specify the file extension you want to delete
num_chambers = 6 # Number of chambers in the revolver

russian_roulette_delete(directory, file_extension, num_chambers)
Empty file added pyscript.py.bak
Empty file.