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

Kursinnehåll

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

Uppgift

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 desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 5
toggle bottom row

book
Challenge: Converting Kilometers to Miles

Uppgift

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 desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 2. Kapitel 5
Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Vi beklagar att något gick fel. Vad hände?
some-alt