Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Handle More Complex Math in Python | First Acquaintance with Python
Introduction to Python(ihor)
course content

Cursusinhoud

Introduction to Python(ihor)

Introduction to Python(ihor)

1. First Acquaintance with Python
2. Variables and Types in Python
3. Conditional Statements in Python
4. Other Data Types in Python
5. Loops in Python
6. Functions in Python

book
Handle More Complex Math in Python

Python provides several additional math operations, including floor division (//) for integer division, modulus (%) to find the remainder after division, and exponentiation (**) for raising a number to a power.

12345678
# Floor division print(18 // 4) # Remainder of the division print(18 % 4) # Raising to the power print(18 ** 4)
copy

These mathematical operations may seem confusing at first, especially with division and related operators, but they're actually quite simple.

Floor division gives the whole number result of division, while the remainder shows what's left. Exponentiation is multiplying a number by itself repeatedly.

Taak

Swipe to start coding

You have $250 and want to buy as many cookie packs as possible, with each pack costing $6. Determine how many packs you can buy and how much money will remain.

  • Compute the floor division of 250 by 6 to find out how many full packs you can buy.
  • Determine the remainder when 250 is divided by 6 to see how much money will be left after buying the packs.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 4
toggle bottom row

book
Handle More Complex Math in Python

Python provides several additional math operations, including floor division (//) for integer division, modulus (%) to find the remainder after division, and exponentiation (**) for raising a number to a power.

12345678
# Floor division print(18 // 4) # Remainder of the division print(18 % 4) # Raising to the power print(18 ** 4)
copy

These mathematical operations may seem confusing at first, especially with division and related operators, but they're actually quite simple.

Floor division gives the whole number result of division, while the remainder shows what's left. Exponentiation is multiplying a number by itself repeatedly.

Taak

Swipe to start coding

You have $250 and want to buy as many cookie packs as possible, with each pack costing $6. Determine how many packs you can buy and how much money will remain.

  • Compute the floor division of 250 by 6 to find out how many full packs you can buy.
  • Determine the remainder when 250 is divided by 6 to see how much money will be left after buying the packs.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 4
Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Onze excuses dat er iets mis is gegaan. Wat is er gebeurd?
some-alt