import time, os, sys
import random
st = 0.05
def sp(str):
for letter in str:
sys.stdout.write(letter)
sys.stdout.flush()
time.sleep(st)
print()
black = ("\u001b[30mඞ")
red = ("\u001b[31mඞ")
green = ("\u001b[32mඞ")
yellow = ("\u001b[33mඞ")
blue = ("\u001b[34mඞ")
magenta = ("\u001b[35mඞ")
cyan = ("\u001b[36mඞ")
white = ("\u001b[37mඞ")
run_game = True
char = random.choice(["imposter", "crewmate"])
color = random.choice([black, red, green, yellow, blue, magenta, cyan, white])
nums = ['1', '2', '3']
task = {
"cafeteria" : ["Clean Chute", "Download Data", "Fix Wiring"],
"admin" : ["Upload Data", "Swipe Card", "Fix Wiring"]
}
print(black, red, green, yellow, blue, magenta, cyan, white)
sp(f"You are {color}\u001b[37m and you are {char}.")
sp("\n\nThe game will start in 3 seconds")
def game():
while run_game:
choice = input("\nYou are a crewmate and are in cafeteria. What do you want to do:\n[1] Do tasks in cafeteria.\n[2] Call an emergency meeting.\n[3] Go to a different room.\nEnter the number (1-3)>>> ")
while choice in nums:
if choice == '1':
task_cafe = input("Here are the tasks you can do in cafeteria:\n")
if char == 'crewmate':
game()
How do I delete one of the elements in the list defined to 'cafeteria' in the dictionary 'task'. Also after I display the input of "task_cafe" I want to print all elements in the list defined to 'cafeteria' in the dictionary 'task' in each line. Like this:
Here are the tasks you can do in cafeteria:
[1] Clean Chute
[2] Download Data
[3] Fix Wiring
Enter the number (1-3) >>>