Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Bringing Python Fundamentals Together | First Acquaintance with Python
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to Python (dev copy)

bookBringing Python Fundamentals Together

Opgave

Swipe to start coding

  1. Print a title "Shopping Receipt" and a divider line (using -) with print().
  2. Print the price for the first item:
    • It is priced per weight at $162 per unit.
    • The customer bought 1.2 of it.
    • Calculate and print the total price for this item.
  3. Print the price for the second item:
    • Originally $25, but comes with a discount of $3.
    • Calculate and print the final price after the discount.
  4. Print the subtotal and tax (8%) using print().
Shopping Receipt
------------------------
Item 1: $194.4
Item 2: $22
------------------------
Subtotal: $216.4
Tax (8%): $21.64
------------------------
Thank you for shopping!

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 5
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Opsummér dette kapitel

Explain code

Explain why doesn't solve task

close

bookBringing Python Fundamentals Together

Stryg for at vise menuen

Opgave

Swipe to start coding

  1. Print a title "Shopping Receipt" and a divider line (using -) with print().
  2. Print the price for the first item:
    • It is priced per weight at $162 per unit.
    • The customer bought 1.2 of it.
    • Calculate and print the total price for this item.
  3. Print the price for the second item:
    • Originally $25, but comes with a discount of $3.
    • Calculate and print the final price after the discount.
  4. Print the subtotal and tax (8%) using print().
Shopping Receipt
------------------------
Item 1: $194.4
Item 2: $22
------------------------
Subtotal: $216.4
Tax (8%): $21.64
------------------------
Thank you for shopping!

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 5
single

single

some-alt