DEV Community

Cover image for Learn Python: Numbers
Rishi
Rishi

Posted on • Edited on

2 1

Learn Python: Numbers

Numbers

Integer

i_am_an_integer = 2020 
print(i_am_an_integer)
Enter fullscreen mode Exit fullscreen mode

Float

i_am_a_float = 20.123456  
print(i_am_a_float)
Enter fullscreen mode Exit fullscreen mode

Arthmetic Operations

maths_operation = 6 + 5 - 4 * 3 / 2
print(maths_operation)
Enter fullscreen mode Exit fullscreen mode

Division

Division always returns a float.

float_division = 48 / 2 
print(float_division);
Enter fullscreen mode Exit fullscreen mode


float_division2 = 49 / 3 
print(float_division2);
Enter fullscreen mode Exit fullscreen mode

Integer Division

To do integer division, we must use: //.

integer_division = 50 // 2 
print(integer_division);
Enter fullscreen mode Exit fullscreen mode


integer_division2 = 49 // 3 
print(integer_division2);
Enter fullscreen mode Exit fullscreen mode

Modulus | Remainder

remainder = 17 % 5;
print(remainder)
Enter fullscreen mode Exit fullscreen mode



Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay