Results for “print function”

Showing 41–50 of 79

  1. Challenge

    Log to a file

    …with with open(), one per line, read the file back and print it, then add an append_entry() function that adds lines at the end without wiping what is there.

    Write the code Easy 2 stages files open with write
  2. Challenge

    Prove the fix

    …it stays fixed? Six months from now someone will tidy the function, and log=[] looks so much simpler than the None check. Write the test that proves the fix: it has to pass now and fail on the old…

    Write the code Medium 2 stages testing assert regression tests default values
  3. Challenge

    Test the parser

    Write assert checks for parse_line() from "Parser function": the whole record for a good line first, then None for a blank line, a comment and a line with a missing field, so a broken parser can't…

    Write the code Medium 2 stages testing assert parsing None
  4. Article Mini projects

    Calculating Escape Velocity in Python

    …Instead of Regular Python? While Python's built-in math functions work fine for simple calculations, NumPy offers several advantages for scientific computing: More efficient for large-scale…

  5. Article Mini projects

    Converting Temperatures in Python

    …beginner Python programmer should be able to handle them. Functions for converting temperatures Let's define 2 functions necessary for our calculations. These will be the celsius_to_kelvin and…