7 kyu
Thinkful - Logic Drills: Umbrella decider
1,812 of 2,485Grae-Drake
Description:
Write a function take_umbrella()
that takes two arguments: a string representing the current weather and a float representing the chance of rain today.
Your function should return True
or False
based on the following criteria.
- You should take an umbrella if it's currently raining or if it's cloudy and the chance of rain is over
0.20
. - You shouldn't take an umbrella if it's sunny unless it's more likely to rain than not.
The options for the current weather are sunny
, cloudy
, and rainy
.
For example, take_umbrella('sunny', 0.40)
should return False
.
As an additional challenge, consider solving this kata using only logical operaters and not using any if
statements.
Fundamentals
Similar Kata:
Stats:
Created | Dec 29, 2016 |
Published | Dec 29, 2016 |
Warriors Trained | 3198 |
Total Skips | 41 |
Total Code Submissions | 13324 |
Total Times Completed | 2485 |
Python Completions | 1812 |
JavaScript Completions | 710 |
Total Stars | 27 |
% of votes with a positive feedback rating | 87% of 396 |
Total "Very Satisfied" Votes | 310 |
Total "Somewhat Satisfied" Votes | 66 |
Total "Not Satisfied" Votes | 20 |
Total Rank Assessments | 12 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |