Chance It Doesn't Rain
Whetcode Events runs outdoor weddings, and every contract carries a weather clause. The forecast feed gives a probability that rain falls at the venue. The clause is written the other way round — it needs the probability the day stays dry — and the coordinator reruns the same line every morning against that morning's forecast, so the figure has to come out of the code rather than out of her head.
Treat rain and no-rain as the only two possibilities: they cannot both happen, and nothing else can happen instead.
Task: Print the probability that it does not rain, rounded to 2 decimals.
Input
One line holding the forecast probability of rain, a decimal number between 0 and 1 inclusive.
Output
One line holding the probability of no rain, rounded to 2 decimals and printed the way Python prints a float — 0.7, never 0.70.
Example:
Input:
0.3
Output:
0.7
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in