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

Stats:

CreatedDec 29, 2016
PublishedDec 29, 2016
Warriors Trained3198
Total Skips41
Total Code Submissions13324
Total Times Completed2485
Python Completions1812
JavaScript Completions710
Total Stars27
% of votes with a positive feedback rating87% of 396
Total "Very Satisfied" Votes310
Total "Somewhat Satisfied" Votes66
Total "Not Satisfied" Votes20
Total Rank Assessments12
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Grae-Drake Avatar
  • suic Avatar
  • St3f4n Avatar
  • hobovsky Avatar
  • mauro-1 Avatar
Ad