Machine Learning News Hubb
Advertisement Banner
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us
Machine Learning News Hubb
No Result
View All Result
Home Machine Learning

What is modulo in Python. We use multiple arithmetic operation in… | by Hiren Patel | Sep, 2022

admin by admin
September 10, 2022
in Machine Learning


We use multiple arithmetic operation in python. such as +,-,*,/,%

here,

we use + is for addition of two numbers.

for example: 2+3 will perform addition and it will return 5 as a result.

3–2 will perform subtraction and it will return 1 as a result.

3*3 will perform multiplication and it will return 9 as a result.

6/2 will perform division and it will return 3 as a result.

now, when we see operator % in calculator we think that it will calculate percentage.

but here in programming language the % operator is called modulo operator.

This % operator will return reminder of division.

Syntax

x % y

For Example:

13%5 will return 3

To demonstrate this, let me take example of apples.

suppose, we have 13 apples and we want to make a group of 5.

from the above picture, we have divided our 13 apples in the group of 5 (because we have 13%5). here leftover Apples are 3.

so, we will get 3 as a answer.

we can find odd and even numbers with the help of %.

3%2 will return 1

2%2 will return 0

hence,

for example we have list of apples:

for apple in range(0,10):

if (apple%2) != 0:

print(apple)

Output:

1

3

5

7

9



Source link

Previous Post

Deep Learning Roadmap & Learning Paths | by Nerd Dev | Sep, 2022

Next Post

The Real Name Behind the Statistical Terms You’re Using | by Amjad El Baba | Sep, 2022

Next Post

The Real Name Behind the Statistical Terms You’re Using | by Amjad El Baba | Sep, 2022

Validate Your pandas DataFrame with Pandera | by Nisar Ahmad | Sep, 2022

Data Science: Linear Regression. Most of us are familiar with a basic… | by Andrew Morse | Sep, 2022

Related Post

Artificial Intelligence

Dates and Subqueries in SQL. Working with dates in SQL | by Michael Grogan | Jan, 2023

by admin
January 27, 2023
Machine Learning

ChatGPT Is Here To Stay For A Long Time | by Jack Martin | Jan, 2023

by admin
January 27, 2023
Machine Learning

5 steps to organize digital files effectively

by admin
January 27, 2023
Artificial Intelligence

Explain text classification model predictions using Amazon SageMaker Clarify

by admin
January 27, 2023
Artificial Intelligence

Human Resource Management Challenges and The Role of Artificial Intelligence in 2023 | by Ghulam Mustafa Shoaib | Jan, 2023

by admin
January 27, 2023
Deep Learning

Training Neural Nets: a Hacker’s Perspective

by admin
January 27, 2023

© 2023 Machine Learning News Hubb All rights reserved.

Use of these names, logos, and brands does not imply endorsement unless specified. By using this site, you agree to the Privacy Policy and Terms & Conditions.

Navigate Site

  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us

Newsletter Sign Up.

No Result
View All Result
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.