Question: 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 between1 and 6. A streak of 6 is when you get 6

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!