Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please answer as soon as possible using python as the programming languge also please explain what you did Exercise A: Exercise B: For this exercise

please answer as soon as possible using python as the programming languge
also please explain what you did
Exercise A:
image text in transcribed
Exercise B:
image text in transcribed
For this exercise you will design and implement a program that will ask the user for 1 an integer and then print out the corresponding "number triangle". Each row of the 22 number triangle should be printed using a repeated sequence of digits that is the 433 same length as the row number (starting from 1), and must use the digit that 55555 corresponds to that row (with one ' 1 ' on the first row, two ' 2 's on the second row, 666666 three ' 3 's on the third row, four ' 4 's on the fourth row, etc.) 7777777 In order to complete this task, you will need to: - decide whether to use a Boolean flag or a break statement for your postcondition loop Your submission for this exercise: - must be a source code file with filename ' 'comp1405_w23_\#\#\#\#\#\#\#\#\#_tutorial_04_a.py' - must use a postcondition, event-controlled loop to ensure input is between 1 and 9 (inclusive) - must use nested counter-controlled loops to construct the number triangle from the input For this exercise you will design and implement a program to play the "Higher / Lower" guessing game with the user. Your program will start by generating a pseudorandom integer that is between 1 and 100 (inclusive), and then the user will have no more than 10 guesses to determine what the selected number was. After each incorrect guess, your program must report whether the actual number is higher or lower than the last guess. In order to complete this task, you will need to: - ensure you know how to use the random library's "randint" function Your submission for this exercise: - must be a source code file with filename 'comp1405_w23_\#\#\#\#\#\#\#\#\#_tutorial_04_b.py' - must import random and use the "randint" function to get the pseudorandom integer - must use a postcondition, event-controlled loop, terminating if user wins or after 10 guesses - must report, after each incorrect guess, whether the actual value is higher or lower - must report whether the user has won or lost the game before ending

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions