Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

Ceil and floor equivalent in Python 3 without Math module?

Asked by Larrylombardo Aug 18, 2025 1.1K views 2 answers
Share

About this question

How can you implement ceil and floor functions in Python 3 without using the Math module? Understanding this helps when you need rounding operations but want to avoid external dependencies or practice logic-based solutions.

Your answer

2 Answers

Peter Latest answer

Answered on Aug 21, 2025

Hello,You can use the floor division operator //.This always rounds toward negative infinity, unlike int() which just chops off the decimal part.

foremostpayonline one time payment

Was this helpful?

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.