Answered step by step
Verified Expert Solution
Question
1 Approved Answer
>>> chases ('frog', 'fly') The frog chases the fly >>> chases('snake', 'frog') The snake chases the frog >>> >>> chases ('hawk', 'snake') The hawk chases
>>> chases ('frog', 'fly') The frog chases the fly >>> chases('snake', 'frog') The snake chases the frog >>> >>> chases ('hawk', 'snake') The hawk chases the snake Ok, now answer these questions by calling your functions and passing in the appropriate arguments. Write the answers next to the corresponding number in the functions.py answer section. 1) What is the sum of 11034567,999, and 76576? 2) Enter the command random.seed (42). Call forecast. What is the chance it will rain? 3) Better verify that Call forecast again. What's the new prediction? 4) What is 90 in radians? 5) 180? 6) What is erf plus gamma of 0.5? 7) What is erf plus gamma of 0.25? 8) What is erf plus gamma of 0.1? Verify that your documentation makes sense and that you've added documentation to each of your functions, per the examples in docstrings.py or any of the posted example code. Verify that your program works by running test functions.py. t 7 17 6.) Write a function called erf plus gamma that takes a number and returns the error function of the number plus the gamma function of the number. Use math.erf and math.gamma and round the result to three decimal places. Here are some examples of calling the function with different arguments. The code executed is in blue, the output produced is in green): erf plus_gamma (0.6) Result: 2.093 erf plus_gamma (0.22) Result: 4.395 Now it is time to use your code to answer some questions and fill in the answer section of functions.py (up near the top): 12 13 Answers to questions: 2.) Write a function called sum3 that takes three numerical arguments and prints their sum in this format (the code executed is in blue, the output produced is in green): sum3 (1, 2, 3) The sum of the arguments is: 6 sum3 (4, 5, 6) The sum of the arguments is: 15 3.) Write a function called forecast that has no parameters. You can see that barebones functions.py that we provided imports the random module. Use random.randrange (101) to get an integer between 0 and 100. This is your forecasted chance of rain, which will be different every time. Print it in the following format (the code executed is in blue, the output produced is in green): forecast() Chance of rain today: 59% forecast Chance of rain today: 74 %
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