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.
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.
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…
Example
Learning to import modules in Python. Modules extend your program capabilities.
Challenge
A real check is commented out and a debug line is left on. Use # comments to put the pre-flight checklist script back in order. A beginner Python challenge on comments.
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…
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…