In Theory: When game_start
is called and the user inputs 'easy'
the variable quiz_paragraph
should assume the value of easy_paragprah
In Actuality: The value of quiz_paragraph
is set to "
I can verify that user_difficulty
is being set properly and is feeding 'easy'
properly into set_difficulty
. The if
statement runs but doesn't alter the value of quiz_paragraph
.
Can anyone tell me what I am missing here?
# Easy Paragraph
easy_paragraph = '''\n___1___ is a programming ___2___ used to solve simple and complex problems. ___1___ like
many languages can be used to display a message to a user using ___3___. Try it sometime.
To display this common message by typing ___3___ '___4___ World!' \n'''
# Init Variables
user_difficulty = ""
quiz_paragraph = ""
# Ask user difficulty
def ask_difficulty():
user_difficulty = raw_input("What difficulty level would you like? ")
return user_difficulty
# Difficulty sets returned Paragraph
def set_difficulty(difficulty):
if difficulty == "easy":
quiz_paragraph = easy_paragraph
return quiz_paragraph
else:
print '''Sorry, that is not a valid choice.'''
# Start the game
def game_start():
set_difficulty(ask_difficulty())
print quiz_paragraph
# Game Start Test
game_start()