Problem Statement
- A spinner has 4 equal sectors with tour options Dubai, Seoul, Switzerland, and Paris.
- P(Seoul)=1/4 p(Paris)=1/4 P(Dubai)=1/4 p(Switzerland)=1/4
- What is the probability of landing on Seoul or Paris after spinning spinner?
- Write a function to return the probability
Note:
- Display the probability in decimal rounded off to 2 decimal places
- Hint: Addition Rule and Mutually Exclusive events
Function Description
Function Name: spinner()
- Output:
- ans: Float - Denotes the probability
Answer:
from scipy import stats
def spinner():
'''
output: ans : Float
'''
#Write your code here
seoul = 1/4
paris = 1/4
dubai = 1/4
swit = 1/4
prob = 1-(seoul+paris)
#Assign the probability value to the variable ans
# Round off to 2 decimal places
ans=round(prob,2)
return ans
if __name__=='__main__':
print(spinner())
Click on the tested image:
No comments:
Post a Comment
If you have any doubts, Please let us know.