import random
import statistics
import plotly.figure_factory as ff

dice_result=[]

for i in range(0,1000):
    dice1=random.randint(1,6)
    dice2=random.randint(1,6)
    dice_result.append(dice1+dice2)
    
mean=sum(dice_result)/len(dice_result)
std_deviation=statistics.stdev(dice_result)
median=statistics.median(dice_result)
# mode=statistics.mode(dice_result)

first_std_dev_start,first_std_dev_end=mean-std_deviation,mean+std_deviation
second_std_dev_start,second_std_dev_end=mean-(2*std_deviation),mean+(2*std_deviation)
third_std_dev_start,third_std_dev_end=mean-(3*std_deviation),mean+(3*std_deviation)

list_of_data_within_1_std_dev=[result for result in dice_result if result > first_std_dev_start and result < first_std_dev_end]
list_of_data_within_2_std_dev=[result for result in dice_result if result > second_std_dev_start and result < second_std_dev_end]
list_of_data_within_3_std_dev=[result for result in dice_result if result > third_std_dev_start and result < third_std_dev_end]



print('mean of the data is {}'.format(mean) )
print('median of the data is {}'.format(median) )
print('std_deviation of the data is {}'.format(std_deviation) )
# print('mode of the data is {}'.format(mode) )
print('{}% of the data lies within 1 standard deviation'.format(len(list_of_data_within_1_std_dev)*100.0/len(dice_result)))
print('{}% of the data lies within 2 standard deviation'.format(len(list_of_data_within_2_std_dev)*100.0/len(dice_result)))
print('{}% of the data lies within 3 standard deviation'.format(len(list_of_data_within_3_std_dev)*100.0/len(dice_result)))


# fig=ff.create_distplot([dice_result],['Result'],show_hist=False)

# fig.show()