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
9
1
2
3
4
5
6
7
8
9
#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?
Tack för dina kommentarer!
Avsnitt 2. Kapitel 3
single
9
1
2
3
4
5
6
7
8
9
#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
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal