#๐ Help setting up a challenge for my code.
21 messages ยท Page 1 of 1 (latest)
@umbral valley
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Introduction to the Game
print("Introduction - Welcome to Prison Break. A game where you have one thing on your mind. Escape. \nYou wake up in your prison cell. It's been years since you have been free after being falsely accused for murder. \nOver the past couple months you have been practicing and preparing for your escape. \nNow is the time to do so. \nGuess the correct Code to the Padlock to escape and move on to the hallway. \n")
Room List
roomlist = []
Room 0
room = ["\nRoom 0 - Prison Cell, A small prison cell that traps you inside until you manage to find a way to escape", None, None, None, 1]
roomlist.append(room)
print("You have found the keypad. Type in the code between 1-10")
Challenge 1
import random
num = random.randint(1, 10)
print("Prison Padlock")
print("What is the code (1-10)?")
num_input = int(input("Please guess the number here: "))
while num_input != num:
if num_input > num:
print("\nYou are incorrect. Try again.")
else:
print("\nYou are incorrect. Try again.")
num_input = int(input("\nPlease guess the number here: "))
if num_input == num:
print("\nYou are correct!")
# Update the room to Room 0 after the correct guess
current_room = 0
print(roomlist[current_room][0])
else:
room = ["\nRoom 0 - Prison Cell, A small prison cell that traps you inside until you manage to find a way to escape", None, None, None, 1]
Room 1
room = ["Room 1 - Hallway, Description", None, 0, None, 2]
roomlist.append(room)
Challenge 2
if current_room == 1:
score = 0
q1 = input("What room are you in? \na) 0 \nb) 1 \nc) 4 \nd) 152")
if q1 == "b":
print("You are Correct!")
score += 1
elif q1 == "a" or q1 == "c" or q1 == "d":
print("You are Incorrect!")
else:
print("Invalid Input")
print(" ")
q2 = input("How many days are in a week? \na) 8 \nb) 3 \nc) 6 \nd) 7")
if q2 == "d":
print("You are Correct!")
score += 1
elif q2 == "a" or q2 == "b" or q2 == "c":
print("You are Incorrect!")
else:
print("Invalid Input")
print(" ")
q3 = input("How many months are in a year? \na) 12 \nb) 6 \nc) 7 \nd) 1")
if q3 == "a":
print("You are Correct!")
score += 1
elif q3 == "b" or q3 == "c" or q3 == "d":
print("You are Incorrect!")
else:
print("Invalid Input")
print(" ")
if score == 3:
print("Congratulations! You have completed Challenge 2.")
direction = input("Which way would you like to go? (west/east/north/south) ")
if direction == "west":
# Update the room to Room 2 after completing Challenge 2 and heading west
current_room = 2
print(roomlist[current_room][0])
else:
print("You remain in Room 1.")
else:
print("You did not score high enough to move on to the next room.")
Room 2
room = ["Room 2 - Cafeteria, Description", None, 1, 3, None]
roomlist.append(room)
I need it to only access room 1 after you answer all the questions and get them correct.
Any help would be appreciated because i have been trying this for hours
Python 2.7 btw
where is pastebin
!paste
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
the guide here tells you how to use the pastebin, i can't imagine any way it could not be working
@umbral valley did u understand?
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.