How to Work with Variables in Python
Imagine you got the cost of an item saved in the price
variable and you want to apply a 15% discount. You can simply reassign the updated value like this:
1234567# Initial price price = 50 # Applying the discount price = price * (1 - 0.15) print(price)
Opgave
Swipe to start coding
- A teacher is dividing
47
students into groups of6
. Your task is to determine how many students will not fit into a complete group and store this remainder in thestudents
variable.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 2. Kapitel 3
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Awesome!
Completion rate improved to 1.64
How to Work with Variables in Python
Stryg for at vise menuen
Imagine you got the cost of an item saved in the price
variable and you want to apply a 15% discount. You can simply reassign the updated value like this:
1234567# Initial price price = 50 # Applying the discount price = price * (1 - 0.15) print(price)
Opgave
Swipe to start coding
- A teacher is dividing
47
students into groups of6
. Your task is to determine how many students will not fit into a complete group and store this remainder in thestudents
variable.
Løsning
Var alt klart?
Tak for dine kommentarer!
Awesome!
Completion rate improved to 1.64Sektion 2. Kapitel 3
single