View the step-by-step solution to:

Question

# I am not sure how to perform the tasks for these two exercises. Can someone please show me the correct

code with explanations in order to solve the exercises? Thanks a lot for the help !

Exercise 4: Guess a number Two players:
0 System asks player 1 to type a number between 1 and 100
9 System “clears&quot; the screen, by printing a lot of empty lines 9 System asks player 2 to guess the number inserted by player 1,
repeatedly. At every failed attempt, system tells player 2 if the
number to be guessed is smaller or larger 0 When finally player 2 guesses the number, system
congratulates: “You win! You guessed in n attempts&quot;. Exercise 5: Guess a number in 10 attempts Like Exercise 4. but now player 2 must guess within 10 attempts.
Otherwise system tells “You lose&quot;.

View the full answer

1- def guess (player1, player2) :
2
if(player1 == player2):
return False
4
return True
5
6
def main ( ) :
17
#system ask player 1 to guess number between 1 to 100
player1 = int(input(&quot;Enter...

### Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

### -

Educational Resources
• ### -

Study Documents

Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

Browse Documents