Python: Fun with Numbers

In this Article I’ll show you diverse functions to calculate in Python.

The first thing you can see is that the user has to define A & B with an „input„. Before that you can see „int„, it stands for integer. So the user is only allowed to put in whole numbers without decimal place. It’s also shown as a comment behind those lines. Comments are easily done by putting a „#“ infront of your comment.

I think that the next three functions explain themselves. The fourth one (line 16 in the picture) is an integer based divison. It means the result of this devision shows only the first figure, without the decimal numbers. It’s done by a double „//„.

With the last function (line 19) „divmod“ you can do an integer based divison and it shows you the remainder of that division. These two function show you the result: „print(result[0])“ & „print(result[1])„. First one shows you the result of the integer based divison, the second one shows you the remainder of that divison. Because I did the integer based divison already I only used the „print(result[1])

That it is how it looks like when you run it:

Thanks for reading my Blog!

Kommentar hinterlassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

Du kommentierst mit Deinem Abmelden /  Ändern )

Google Foto

Du kommentierst mit Deinem Google-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden /  Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden /  Ändern )

Verbinde mit %s

Erstelle deine Website auf
Jetzt starten
%d Bloggern gefällt das: