Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a new function in your function.py script called getAnswer() that takes one numerical argument called answerNumber. use the following code inside the new getAnswer()
Create a new function in your function.py script called getAnswer() that takes one numerical argument called answerNumber.
use the following code inside the new getAnswer() function:
if answerNumber == 1: return 'It is certain' elif answerNumber == 2: return 'It is decidedly so' elif answerNumber == 3: return 'Yes' elif answerNumber == 4: return 'Reply hazy try again' elif answerNumber == 5: return 'Ask again later' elif answerNumber == 6: return 'Concentrate and ask again' elif answerNumber == 7: return 'My reply is no' elif answerNumber == 8: return 'Outlook not so good' elif answerNumber == 9: return 'Very doubtful'
In a new script import this and use the random generator and generate a number between 1 and 9. Pass the number into the getAnswer() function and print out the users fortune.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started