Example
Check Python Version
Simple way to check installed Python version on your system. First step for every programmer.
Showing 1–10 of 20
Example
Simple way to check installed Python version on your system. First step for every programmer.
Challenge
Every useful bug report starts with the Python version. Ask Python for it with the platform and sys modules and print it the way python --version does.
Article Python Fundamentals
…code for years, so don't lose sleep over it. The short version: the parameter is the slot in the definition, the argument is the actual value you send in when you call. More than one parameter…
Article Mini projects
…velocity from Earth: {escape_velocity/1000:.1f} km/s") Version 1: Reusable Function Instead of copying code for each planet, let's create a function: import numpy as np def…
Challenge
…passes only when fuel_needed(-5) raises ValueError, so a version that returns a value or raises the wrong error fails it, then pin down the message and the lengths that must still work.
Article Python Fundamentals
…Visit the official Python website and download the latest version. Remember to check " Add Python to PATH " during installation. For MacOS : Use Homebrew with the command brew install python , or…
Article Mini projects
…temperatures. In the code tab, you can download the full version of the script. As an additional exercise, you can write functions that convert temperatures from Kelvin to degrees Fahrenheit and…
Article Python Fundamentals
…in a week, you'll instantly understand what the second version does. In the Mars examples, we use names like x_position , y_position , scan_x , rover_id - anything that helps understand the code…
Challenge
…constants without changing the output, then write a Mars version with constants from the start.
Article Mini projects
…that survives restarts and detects tampering. This version uses proper HMAC authentication, stores real timestamps, and maintains an append-only audit trail. import hmac import hashlib import json…