n this problem, you have available to you a working version of the function round_up described in part (a). It is located in a module named foo. Using the given round_up function, write a function round_up_all that takes a list of integers and MODIFIES the list so that each number is replaced by the result of calling round_up_ on that number. For example, if you run the code, 1st = [43, 137, 99, 501, 300, 275] round_up_all(1st) print(1st) the list would contain the values [100, 200, 100, 600, 300, 300] Do not re-implement the round_up function, just import the food module and use it. Here is the code for the round_up function that can be imported using foo: def round_up(num): if num % 100 == 0 : #if number is complete divisible return num #return orginal num else: return num + (100-(num % 100)) #else add 100-remainder to num, if __name__ == '__main__': print(round_up(234)) print(round_up(465)) print(round_up(400)) print(round_up(89)
In this problem, you have available to you a working version of the function round_up described in part (a). It is located in a module named foo. Using the given round_up function, write a function round_up_all that takes a list of integers and MODIFIES the list so that each number is replaced by the result of calling round_up_ on that number. For example, if you run the code,
1st = [43, 137, 99, 501, 300, 275]
round_up_all(1st)
print(1st)
the list would contain the values [100, 200, 100, 600, 300, 300]
Do not re-implement the round_up function, just import the food module and use it.
Here is the code for the round_up function that can be imported using foo:
def round_up(num):
if num % 100 == 0 : #if number is complete divisible
return num #return orginal num
else:
return num + (100-(num % 100)) #else add 100-remainder to num,
if __name__ == '__main__':
print(round_up(234))
print(round_up(465))
print(round_up(400))
print(round_up(89))
Step by step
Solved in 2 steps with 1 images