I need assistance with the following python exercise:

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

I need assistance with the following python exercise:

Post by answerhappygod »

I need assistance with the following python exercise:
I Need Assistance With The Following Python Exercise 1
I Need Assistance With The Following Python Exercise 1 (96.6 KiB) Viewed 22 times
13 The Cron acce FOLLOWI 14 1. STRING outlook 15 f 2. STRING windy Your supervisor wants you to write a program that takes in weather conditions to determine whether or not they should go and play golf. They currently use this decision tree to decide if he should play or not play. 16 #3. STRING humidity 17 18 Outlook 19 def playGolf (outlook, windy, humidity): #Write your code here 20 21 sunny 22 rainy outlook. 23 vif_name__ == '__main__': 24 outlook input() Windy 25 25 overcast windy=input() 27 false 28 humidity=input() true Play รา Don't Play Play Don't Play Play 30 playGolf (outlook, windy, humidity)... 31 To read this tree, first we would check the outlook. • If the outlook is rainy, then we check if it is windy. If windy is true, we don't play. If windy is false, we don't play. • If the outlook is overcast, then we can play. • If the outlook is sunny, then we check the humidity. If the humidity is high we don't play. If the humidity is normal, we play. Write a function playGolf that takes in the outlook, windy, and humidity as input and prints out either don't play or play. Examples: Input: "rainy", "True", "high" Output: "play" Input: "overcast", "False", "high" Output: "play" Note: • outlook is a str type and can only have the following values: "rainy", "overcast", "sunny" • windy is a str type and can only have the following values: "True", "False" • humidity is a str type and can only have the following values: "high", "normal" ] Humidity high normal
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply