Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the first lab (in a series) that explores importing custom modules. In this case, you will be provided with the fortune_util module and

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

This is the first lab (in a series) that explores importing custom modules. In this case, you will be provided with the fortune_util module and you will have to use it to craft a program that provides a good experience for the user. There are functions you can use from the fortune_util module. Note that all three of these functions are tested and require no code modification. You are welcome to tinker around in this code, but when you submit this assignment you will only be submitting fortune_machine.py as the fortune_util.py file resides on the testing server at CodeGrade. - get_directions () takes in no arguments and merely outputs the instructions to the user. - get_one_fortune() takes in no arguments and outputs one fortune for the user. - get_multiple_fortunes(num) takes in one argument - an integer - and outputs that number of fortunes. - dashes () takes in no arguments and outputs a line of 40 dashes ' - ' - quit() takes no parameters and displays a goodbye message. Ideally this software would be more effective with loops and if statements so we could craft a smooth, logical experience for the user. But since we haven't explored that yet, we will live with what we have and just call each function in order. But stay tuned - in the not-too-distant future we will be coming back to this lab and making it a better user experience. SPECIFICATIONS - Starter code has been provided for this lab - there are two files: - fortune_machine.py is what will be run when you submit to CodeGrade. This is the only file you will be submitting as the fortune_util.py file resides on the server at CodeGrade. - fortune_util.py is the utility file that supports the main program. You do not have to modify this program, but you should be familiar with the functions in it. - The filename for the program you will be submitting is fortune_machine.py - Complete the function run_fortune_machine in fortune_machine.py as described in the comments of the code. - Add a comment with your name, date, and program description at the top! Welcome to the Fortune Telling Machine The instructions are simple - you may request one fortune, you may request multiple fortunes, or you may request to quit. Please enjoy your fortune(s)! But beware! When you use the Fortune Telling Machine, you get what you get and you don't get upset! ONE FORTUNE: There's a lot of atoms in you. MULTIPLE FORTUNES: How many fortunes would you like? 7 MULTIPLE FORTUNES: How many fortunes would you like? 7 1 - Bring an umbrella today. 2 - There's a lot of atoms in you. 3 - You will live a long, prosperous life. 4 - Chin up! It's going to be a great day! 5 - If you have no pockets, your phone can't fall out of them! 6 - Chin up! It's going to be a great day! 7 - You will live a long, prosperous life. I hope you enjoyed your fortunes... The instructions are simple - you may request one fortune, you may request multiple fortunes, or you may request to quit. Please enjoy your fortune(s)! But beware! When you use the Fortune Telling Machine, you get what you get and you don't get upset! fortune_machine.py Copy this code \# FILE NAME - fortune_machine.py \# AUTHOR - \# DATE - \# DESCRIPTION - import fortune_util def main(): run_fortune_machine () def run_fortune_machine () : Copy this code \# FILE NAME - fortune_util.py \# AUTHOR - Dave Ghidiu \# DATE - October 3, 2022 \# DESCRIPTION - A utility module for telling fortunes import random fortunes =[ 'You will live a long, prosperous life. In', 'Bring an umbrella today. In', 'Fear is for chumps! , 'If you have no pockets, your phone can\' t fall out of them! , "Yoda was wrong. "Trying" is a thing. In', 'Therel's a lot of atoms in you. n, 'Chin up! It 's going to be a great day! ] def get directions () : defquit():print()print(Ihopeyouenjoyedyourfortunes... )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started