Please answer in Python
10.4 PAs 2 Review 4 (4 attempts)
Note: Do not type the prompts. Instead copy them from the
instructions then paste them into your code.
Note: Use standard spacing.
Prompt "Enter the num_users:" then read num_users from the
keyboard.
Prompt "Enter the update_direction:" then read update_direction
from the keyboard.
Using a conditional expression, write a statement that
increments num_users if update_direction is 3, otherwise decrements
num_users.
Ex: if numusers is 8 and updatedirection is 3, then num_users
becomes 9;
if updatedirection is 0, then numusers becomes 7.
Solution
Code
num_users=int(input("Enter the num_users:"))
update_direction=int(input("Enter the update_direction:"))
num_users = num_users + 1 if update_direction == 3 else num_users -
1
print("New value is:",num_users)
Screenshot
Output
---
all the best
Get Answers For Free
Most questions answered within 1 hours.