Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Division and whole part division | Arithmetic operations
Learn Python from Scratch

book
Division and whole part division

Division is easy - just use / operator.

If you use // instead of / Python will calculate the result and take only the whole part.

Please note the the result of division will always be type 'float' (floating point number)

Uppgift

Swipe to start coding

Please calculate the result of whole part division of 10 by 4. Print the result and print the type of resulting variable "c".

Lösning

#Calculate the whole-part division of a by b
a = 10
b = 4
c = 10//4
print(c)

#Print type of variable c
print(type(c))

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 3
single

single

#Calculate the whole-part division of a by b
a = 10
b = 4
c =
print(c)

#Print type of variable c
print()

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

some-alt