We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
# Dice # 1dice_1=[1,2,3,4,5,6]# Dice # 2dice_2=dice_1.copy()less_than_10=0all_outcomes=0# Iterate throughforv1indice_1:forv2indice_2:# add 1 for every pair to all_outcomesall_outcomes+=1ifv1+v2<10:# add 1 for pairs that summed up to 9 or below to less_than_10.less_than_10+=1prob_less_than_10=less_than_10/all_outcomesprint(prob_less_than_10)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 2: Basic Probability
You are viewing a single comment's thread. Return to all comments →