Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

4. assume you are given the variable num. write a program that determin…

Question

  1. assume you are given the variable num. write a program that determines if num is both even and positive number. print out the message \positive even!\ if it is, and the message

egative or odd!\ otherwise.

  1. you are writing the programming code to provide feedback messages for a pop - a - shot basketball game. you will print the appropriate message according to how many baskets the player has made. assume you are given a baskets variable that stores the number of baskets made in the game. you must only print a single message to the player (multiple - messages are not correct).

0 - 9 baskets → \you need more practice\
10 - 19 baskets →
ot bad\
20 - 25 baskets → \pretty good!\
26 or more → \great job!\

Explanation:

Step1: Python code for question 4

num = int(input("Enter a number: "))
if num > 0 and num % 2 == 0:
    print("Positive even!")
else:
    print("Negative or odd!")

Step2: Python code for question 5

baskets = int(input("Enter the number of baskets made: "))
if baskets >= 0 and baskets <= 9:
    print("You need more practice")
elif baskets >= 10 and baskets <= 19:
    print("Not bad")
elif baskets >= 20 and baskets <= 25:
    print("Pretty good!")
elif baskets >= 26:
    print("Great job!")

Answer:

The above Python - code snippets solve the two programming problems as required. For the first problem, it checks if a number is positive and even and prints the appropriate message. For the second problem, it prints the appropriate feedback message based on the number of baskets made in a Pop - a - Shot basketball game.