Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Converting Kilometers to Miles | Variables and Types in Python
Introduction to Python
course content

Kursusindhold

Introduction to Python

Introduction to Python

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
Challenge: Converting Kilometers to Miles

Opgave

Swipe to start coding

The road distance between San Francisco and New York is approximately 4677.4 km. This distance is stored in the variable distance_in_kilometers.

Here's what you need to do:

  • Convert the distance from kilometers (distance_in_kilometers) to miles by dividing it by 1.609. Store the result in the variable distance_in_miles.
  • Create a variable int_distance_in_miles.
  • Convert the variable distance_in_miles to an integer data type.
  • Store the value of distance_in_miles as an integer in the variable int_distance_in_miles.

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 2. Kapitel 5
toggle bottom row

book
Challenge: Converting Kilometers to Miles

Opgave

Swipe to start coding

The road distance between San Francisco and New York is approximately 4677.4 km. This distance is stored in the variable distance_in_kilometers.

Here's what you need to do:

  • Convert the distance from kilometers (distance_in_kilometers) to miles by dividing it by 1.609. Store the result in the variable distance_in_miles.
  • Create a variable int_distance_in_miles.
  • Convert the variable distance_in_miles to an integer data type.
  • Store the value of distance_in_miles as an integer in the variable int_distance_in_miles.

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 2. Kapitel 5
Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Vi beklager, at noget gik galt. Hvad skete der?
some-alt