Results for “constants”

Showing 1–10 of 11

  1. Challenge

    Magic numbers

    Turn the bare 9.81 and 1000 in a weight report into named constants without changing the output, then write a Mars version with constants from the start.

    Fix the code Easy 3 stages constants refactoring variables clean code
  2. Challenge

    Signal delay

    …by speed. The speed of light is already in the code as a constant, in kilometres per second. Minutes and seconds Nobody talks about a delay of 750.5 seconds. Show it as whole minutes and seconds…

    Write the code Medium 3 stages division round // %
  3. Challenge

    Fuel for a burn

    Ask for an engine burn length with input(), turn it into a number with float() and work out the propellant it uses, then read the tank level too and show what the burn leaves.

    Write the code Easy 2 stages input float type conversion multiplication
  4. Article Mini projects

    Calculating Escape Velocity in Python

    …# 6.371 × 10⁶ (6,371,000 meters) gravity_constant = np.float64(6.674e-11) # 6.674 × 10⁻¹¹ (very small number) # NumPy handles these numbers efficiently print(f"Earth's mass: {earth_mass}") # Will…

  5. Challenge

    Downlink time

    …over several passes. Add PASS_S = 600 next to the other constant and print how many passes the file needs: Downlink time: 27 min 47 s Ground station passes: 3 A download that takes exactly 30 minutes…

    Write the code Medium 3 stages input float bits and bytes round