In: Computer Science
. Create a Python function that asks the user for a number (integer). The function should then tell the user how many hundreds can go into the number, and how much is left over.
Hint: the % operator calculates the remainder of a division. For example, 10 % 3 gives a result 1.
Hint2: Deal with the positive and negative values in separate parts of an if-else structure. Get the calculation work for positive values first. For negative values, make them positive (num = -num) and then use the same method as for positive values, adapting as
this is a python program so i need your help to complete this task. as i have to submit it by tomorrow.
thanks
SCREENSHOT:
CODE:
def func_rem():
##Prompt to enter the number
num = int(input("Enter a number: "))
##Check if the number is negative
if(num < 0):
##Making the number positive
num = -num;
##calculating the remainder when the number is divided by
100
rem = num % 100;
## subtracting the remainder from the original number
new_whole_num = num - rem;
## Calculating the number of times 100 can wholly go into the
number
num_times_100 = new_whole_num/100;
##The output
print("The number of times 100 can go into " + str(num) + " is " +
str(num_times_100) + " with " + str(rem) + " left")
func_rem()
OUTPUT: