Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help with this python code. 1. Dice probability distribution simulation (20 points) You roll the dice 10,000 times. Each time you get one of
Please help with this python code.
1. Dice probability distribution simulation (20 points) You roll the dice 10,000 times. Each time you get one of six sides with a probability of 1/6. You need to generate the total number of occurrences for each side, store them in a dictionary. For example: If you roll the dice 10 times. Assume the number of occurrences for each side is this: Then the output is: {1:3,2:0,3:2,4:1,5:1,6:3} Hint: This rolling is equal to choosing a random number in [1,2,3,4,5,6]. You need to use to generate an integer between 1 and 6 . 2. Sentence comparison (20 points) You receive two sentences as inputs from the keyboard and compare them. The output is the number of common unique characters in two sentences. It should be case insensitive. For example: sentence 1: "I like Python programming" sentence 2: "I like java" Then the output is: 6. (they are: i,1,k,e,a, and space). Hint: To convert a string to a lowercase string, use s.lower0 >x= 'HELLO' print(x.lower()) Hello
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started