Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

how to give div and mod in python3

0 votes
asked Mar 10, 2021 by Rashin Kannangara (120 points)

2 Answers

0 votes
answered Mar 13, 2021 by xDELLx (10,500 points)

as long as you are dealing with numerical values the ' / ' symbol will divide numbers.

Symbol ' % ' will give mod between the 2 numbers.

Examples below:

>>> x = 4/5
>>> x
>>> x = 4%5
>>> x

0 votes
answered Apr 21, 2021 by kopals06 (140 points)

Operations in Python

+.    Addition (Sum of x and y)

-     Subtraction (Difference between x and y)

*     Multiplication (Product of x and y)

/     Division (Quotient of x and y)

**    Exponent (x to the power of y)

//     Integer Division (Gives the non-rounded integer part of the quotient of the division between x and y)

%    Mod (Gives the remainder from the division between x and y)

You can go to this link for more information about python operators: https://www.w3schools.com/python/gloss_python_arithmetic_operators.asp

Hope this helps

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.