This is the program i have been given. I have to change it to meet the following criteria but can only change the body of the show_flashcard function # IMPORTANT # Q2 (a)(iii) Make changes only to # -- the docstring for the program as a whole. # -- the docstring of the show_flashcard() function # -- the body of the show_flashcard() function. def show_flashcard(): """ Show the user a random key and ask them to define it. Show the definition when the user presses return. """ random_key = choice(list(word_list)) print('Define: ', random_key) input('Press return to see the definition') print(word_list[random_key]) # Set up the word_list word_list = {'black':'noir', 'red':'rouge', 'yellow':'jaune', 'orange':'orange', 'white':'blanc', 'green':'vert'} # The interactive loop exit = False while not exit: user_input = input('Enter s to show a flashcard and q to quit: ') if user_input == 'q': exit = True elif user_input == 's': show_flashcard() else: print('You need to enter either q or s.')
This is the
I have to change it to meet the following criteria but can only change the body of the show_flashcard function
# IMPORTANT
# Q2 (a)(iii) Make changes only to
# -- the docstring for the program as a whole.
# -- the docstring of the show_flashcard() function
# -- the body of the show_flashcard() function.
def show_flashcard():
""" Show the user a random key and ask them
to define it. Show the definition
when the user presses return.
"""
random_key = choice(list(word_list))
print('Define: ', random_key)
input('Press return to see the definition')
print(word_list[random_key])
# Set up the word_list
word_list = {'black':'noir',
'red':'rouge',
'yellow':'jaune',
'orange':'orange',
'white':'blanc',
'green':'vert'}
# The interactive loop
exit = False
while not exit:
user_input = input('Enter s to show a flashcard and q to quit: ')
if user_input == 'q':
exit = True
elif user_input == 's':
show_flashcard()
else:
print('You need to enter either q or s.')
![Word_List_Flashcards.py
File Edit Format Run Options Window Help
# IMPORTANT
# Q2 (a) (iii) Make changes only to
#
#
#
--
--
--
the docstring for the program as a whole.
the docstring of the show_flashcard() function
the body of the show_flashcard() function.
- C:\Users\KGM\Downloads\Word_List_Flashcards.py (3.9.13)
def show_flashcard ():
""" Show the user a random key and ask them
to define it. Show the definition
when the user presses return.
111111
random_key = choice (list (word_list))
print ('Define: ', random_key)
input ('Press return to see the definition')
print (word_list [random_key])
# Set up the word_list
word_list = {'black': 'noir',
'red': 'rouge',
'yellow': 'jaune',
'orange': 'orange',
'white': 'blanc',
'green': 'vert'}
# The interactive loop
exit = False
while not exit:
if user_input
user_input = input('Enters to show a flashcard and q to quit: ')
'g':
else:
==
exit = True
elif user_input = 'S':
show_flashcard ()
I
print('You need to enter either q or s.')](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F47200b4c-a8f9-447b-94f9-99e5421d54a1%2Fea672a6e-9a9e-4abe-8ddf-4f5f6e73363f%2Ft90l0f7_processed.png&w=3840&q=75)

Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images









