144k views
0 votes
write an if-else statement that assigns finalvalue with uservalue 5 if uservalue is greater than 100. otherwise assign finalvalue with

1 Answer

4 votes

Answer:

Here is an if-else statement that assigns finalvalue with uservalue + 5 if uservalue is greater than 100. Otherwise, it assigns finalvalue with uservalue - 5.

if uservalue > 100:

finalvalue = uservalue + 5

else:

finalvalue = uservalue - 5

Step-by-step explanation:

In this statement, we first check if uservalue is greater than 100. If it is, we assign finalvalue with the value of uservalue + 5. Otherwise, we assign finalvalue with the value of uservalue - 5.

This if-else statement provides a simple way to assign a value to finalvalue based on the value of uservalue. If uservalue is greater than 100, finalvalue will be assigned a value that is 5 greater than uservalue. Otherwise, finalvalue will be assigned a value that is 5 less than uservalue.

User James W Simms
by
4.4k points