Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

we have to write two programs in this solution 1. ) A program to count and print the number of occurences of all combinations in

we have to write two programs in this solution 1.) A program to count and print the number of occurences of all combinations in two dice roll 2.) A program to count the number of alphabets in a given string ******Roll.py****** #%% import matplotlib.pyplot as plt # plotting library, import numpy as np import random import seaborn as sns # seaborn: statistical data visualization, https://seaborn.pydata.org/ #%%  rolls = [random.randrange(1, 7) for i in range(600)] values, frequencies = np.unique(rolls, return_counts=True) title = f'Rolling a Six-Sided Die {len(rolls):,} Times'  #https://seaborn.pydata.org/tutorial/color_palettes.html#palette-tutorial axes = sns.barplot(values, frequencies, palette='bright')  axes.set_title(title) axes.set(xlabel='Die Value', ylabel='Frequency')  for bar, frequency in zip(axes.patches, frequencies):  text_x = bar.get_x() + bar.get_width() / 2.0  text_y = bar. get_height()  text = f'{frequency:,} {frequency / len (rolls):.1%}'  axes.text(text_x, text_y, text, fontsize=11, ha='center', va='bottom')  plt.show() #%% 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions