YouTip LogoYouTip

Python Func Divmod

Python divmod() Function

Python divmod() Function

-- Learning is not just about technology, but also about dreams!

Python Basic Tutorial

Python Basic Tutorial Python Introduction Python Environment Setup Python Chinese Encoding Python VS Code Python Basic Syntax Python Variable Types Python Operators Python Conditional Statements Python Loop Statements Python While Loop Statement Python for Loop Statement Python Nested Loops Python break Statement Python continue Statement Python pass Statement Python Number Python Strings Python Lists Python Tuples Python Dictionary Python Date and Time Python Functions Python Modules Python File I/O Python File Methods Python Exceptions Python OS File/Directory Methods Python Built-in Functions

Python Advanced Tutorial

Python Object-Oriented Python Regular Expressions Python CGI Programming Python MySQL Python Network Programming Python SMTP Python Multithreading Python XML Parsing Python GUI Programming (Tkinter) Python2.x vs 3.x Differences Python IDE Python JSON Python AI Drawing Python 100 Examples Python Quiz

Python OS File/Directory Methods

Python Object-Oriented

Deep Dive

  • Programming Languages
  • Web Services
  • Scripts
  • Software
  • Computer Science
  • Web Design & Development
  • Web Service
  • Scripting Languages
  • Development Tools
  • Programming

Python2.x Python divmod() Function

Python Built-in Functions Python Built-in Functions

The Python divmod() function combines the division and remainder operations, returning a tuple containing the quotient and remainder (a // b, a % b).

Handling complex numbers was not allowed before Python version 2.3.

Function Syntax

divmod(a, b)

Parameter Description:

  • a: Number
  • b: Number

Example

>>>divmod(7, 2)
(3, 1)
>>>divmod(8, 2)
(4, 0)
>>>divmod(1+2j,1+0.5j)
((1+0j), 1.5j)

Python Built-in Functions Python Built-in Functions

← Vue Component Custom EventPython Func Range β†’