OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How would I round a number to a grid using python?

  • Thread starter Thread starter Benjamin Ecker
  • Start date Start date
B

Benjamin Ecker

Guest
I would like to know how to round numbers to a grid using python. Here is pseudo-code to demonstrate:

Code:
GRID_SIZE = 20

def snap_function():
    # snap here
    pass

snapped_number = snap_function(68)
print(snapped_number)
# result is 60

I don't know if I gave enough, thanks!
<p>I would like to know how to round numbers to a grid using <code>python</code>.
Here is pseudo-code to demonstrate:</p>
<pre><code>GRID_SIZE = 20

def snap_function():
# snap here
pass

snapped_number = snap_function(68)
print(snapped_number)
# result is 60
</code></pre>
<p>I don't know if I gave enough, thanks!</p>
 

Latest posts

Online statistics

Members online
0
Guests online
3
Total visitors
3
Top