Results for “if”

Showing 91–100 of 100

  1. Challenge

    Landing site

    …Site: 18.4447° N, 77.4508° E Choose each letter with an if : 0 and above is N or E, below 0 is S or W. abs() gives a number without its sign. Curiosity's landing site, (-4.5895, 137.4417), would be…

    Write the code Easy 2 stages tuples unpacking formatting coordinates
  2. Challenge

    Search the log

    …gives the index of the first character of the match, or -1 if there's no match at all. The message The flight director wants just the message that comes after ERROR and the space after it. Add a line…

    Write the code Medium 2 stages strings in find slicing
  3. Challenge

    Magic numbers

    …. Every copy is a place someone would have to change if the report were rerun for the Moon. Modify. Add two constants above the prints, written in capitals so everyone knows they don't change, for…

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

    Log line format

    …alarms go off when an ERROR line appears. That only works if every line has exactly the same shape: [T+00:12:05] INFO Engines nominal The time since launch in square brackets, the level, two spaces…

    Write the code Easy 2 stages f-strings print logs formatting
  5. Article Python Fundamentals

    Numbers and Basic Math Operations in Python

    …Total power production How many computers can run if each needs 100 watts Remaining watts after powering the computers Use modulus (%) to find the remaining watts. Photo by Kier in Sight Archives on…

  6. Article Python Fundamentals

    Variables and data types in Python

    …del from nonlocal while and elif global not with as else if or yield break except import pass Example of valid variable names in space context: orbital_velocity = 7.8 # kilometers per second…

  7. Article Mini projects

    Python Random Module

    …Making It More Interesting What if we want to add some mission parameters? Let's create a more advanced function: def generate_mission(): planet, details = select_random_destination() mission_duration…