Python Forum
Substracting number with a limit - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Homework (https://python-forum.io/forum-9.html)
+--- Thread: Substracting number with a limit (/thread-7972.html)



Substracting number with a limit - mrplow92 - Feb-01-2018

Hello,
I'm new to this forum since I'm starting to use Python at school.

In one of my homework, I need to be able to substract a meter when it will reach the limit of 999999999 from the new number ie: 000000027 so I will print the number 28

It might be easy so this is why I'm turning to this forum.

Thank you.


RE: Substracting number with a limit - jmcatena91 - Feb-01-2018

Are you asking how you would go about a counter that goes 0-999999999 <-- (that being the limit), then once it does it will subtract from a different number?


RE: Substracting number with a limit - mrplow92 - Feb-01-2018

As for now since I'm substracting from the last number entered ie: 000000027 - 999999999, I will get a negative number. I need to find the twist to see 28 printed on screen.

Thanks.


RE: Substracting number with a limit - gruntfutuk - Feb-01-2018

I suggest you get out a pen and paper, and work out the basic principle of the arithmetic using a much smaller range. Say a meter that goes from 20 to 40.