Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Exercise 8 When throwing a dice you can get integers between 1 and 6. A streak of 6 is when you get 6 several times
Exercise 8 When throwing a dice you can get integers between 1 and 6. A streak of 6 is when you get 6 several times in a row. Write a function longestStreakSix which has a list as parameter. This list consists of integers between 1 and 6 (representing successive dice throws). The function should return the longest streak of 6 . In the main program, generate a random list of integers between 1 and 6 based on a number provided by the user and then reveal the longest streak of 6 in this list, as per below sample runs: How many times do you want to roll the dice? 20 Output of dice rolls: [4,3,3,2,3,3,1,3,3,1,4,2,2,4,6,5,4, 2,5,3] Longest streak of 6: 1 > How many times do you want to roll the dice? 20 Output of dice rolls: [4,3,4,5,3,1,5,3,4,6,2,4,6,6,2,3,5, 3,1,5] Longest streak of 6: 2 Exercise 7 How much time did you spend learning your multiplication tables in primary school? The goal of this exercise is to reproduce a multiplication table up to the value provided by the user. In this exercise we want the presentation to be nice with perfectly aligned columns. You can use the string method rjust to justify right a string with a given number of spaces (for example " 12 ".rjust(3) would add a space in front of 12 so that the klength becomes 3 ). For now your program should work for tables up to 9 at most. Sample runs
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