# I need help with my code. (I'm new to this so the code may be sucky)

So I’m trying to create a Truth or Dare game. Everything works except the last two lines of code where it’s supposed to print a random selection from the Truths list (I didn’t add a line a code for Dare because I wanted to test the Truth list first). no error is showing up, it simply codes perfectly up until the last two lines of code. I’m thinking maybe the function I created has something to do with it?

‘’’
import random
truths_section = [“Is it True you still suck your thumb because you think it tastes like chicken?”,
“Is it True that you smell your own farts?”, “Is it True you eat your boogers?”]
dares_selection = [“I Dare you to eat a Peanut Butter and Mayonnaise Sandwich.”, “I Dare you to go outside and eat the first bug you find.”,
“I Dare you to confess your darkest secret.”, “I Dare you to confess who you’re crushing on.”]

def welcome():
print("Welcome to Truth or Dare… wan’t to play? ")
player_response = input("reply yes or no: ")
player_response = player_response.lower()
if player_response == ‘yes’:
print(“Let’s begin…”)
else:
print(“Come back when you wan’t to have some fun…”)

welcome()
start_game = input("Last chance to back out or keep going…reply yes to begin: ")
start_game = start_game.lower()
if start_game == ‘yes’:
num_ofplayers = int(input("How many players do we have? "))
if num_ofplayers >= 1:
print(“Decide who will be player 1, and so on…Then let’s begin.”)
starting_Player = random.randint(1, num_ofplayers)
print(“Player #:”, starting_Player, “is up first.”)
start_point = input("Truth or Dare?: ")
start_point = start_point.lower()
if start_point == ‘True’:
print(random.choice(truths_section))
‘’’

Hello @Aharris, welcome to Python Discourse
Can you please format your code correctly with markdown code-fence (triple backtick (```)), like the example below:

`````````
# type or paste code here
print("Hello World")
```
``````

Or you can use `</>` toolbar in the editor to format your code
https://commonmark.org/help/tutorial/09-code.html

``````if start_point == ‘True’:
print(random.choice(truths_section))
``````

Did you mean:

``````if start_point == "truth":
print(random.choice(truths_section))
elif start_point == "dare":
print(random.choice(dare_section))
else:
print("Input error")
``````

because if you input string `"truth"` or `"dare"` and compare it with string “true” it return `False`:

``````Python 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)] on win32
>>> "dare" == "True"
False
>>> "truth" == "True"
False
>>> "dare" == "dare"
True
>>> "truth" == "truth"
True
>>>
``````

I am new to programming, so if my solution also sucks sorry

``````import random
import sys

truths_section = [
"Is it True you still suck your thumb because you think it tastes like chicken?",
"Is it True that you smell your own farts?",
"Is it True you eat your boogers?",
]
dares_selection = [
"I Dare you to eat a Peanut Butter and Mayonnaise Sandwich.",
"I Dare you to go outside and eat the first bug you find.",
"I Dare you to confess your darkest secret.",
"I Dare you to confess who you're crushing on.",
]

def welcome():
print("Welcome to Truth or Dare… wan't to play? ")
player_response = input("reply yes or no: ")
player_response = player_response.lower()
if player_response == "yes":
print("Let's begin…")
else:
print("Come back when you wan't to have some fun…")
sys.exit()

def gameplay():
start_game = input("Last chance to back out or keep going…reply yes to begin: ")
start_game = start_game.lower()
if start_game == "yes":
num_ofplayers = int(input("How many players do we have? "))
if num_ofplayers > 1:
print("Decide who will be player 1, and so on… Then let's begin.")
starting_Player = random.randint(1, num_ofplayers)
print("Player #:", starting_Player, "is up first.")
while True:
start_point = input("Truth or Dare?: ")
start_point = start_point.lower()
if start_point == "truth":
print(random.choice(truths_section))
elif start_point == "dare":
print(random.choice(dares_selection))
else:
print("Input Error!")
sys.exit()

welcome()
gameplay()
``````

Hey thank you for the help. I was setting the truth or dare to “True” incorrectly. I didn’t create the second function (just so I can rule out what was wrong with what I was doing) but I set it as a condition the way you did and it worked. Then it would only print the Dares. I messed around with it some more and figured out since its says “While True” with a capital T , I had to use a lower case t (if start_point == “truth”)