**New course!**Every coder should learn

**Generative AI!**

+ 4

# Hw can i get both quotient and remainder in python, at the same time! Mayb side by side!

a//b and a%b giving me c, d

3 Answers

+ 21

c, d = a//b, a%b
is valid in Python

+ 10

You can use divmod() method which returns a tuple of a//b and a%b:
a = 10
b = 7
c, d = divmod(a, b)
print(c, d)
>>>
1 3

+ 2

thanks everyone, God bless u all.