Challenge
Read the traceback
…line just above it is where it happened. Fill in error_type , crash_function and crash_line at the end of the program, then fix the bug on that line so the program prints: Average: 695.0 K Fix the…
Showing 21–28 of 28
Challenge
…line just above it is where it happened. Fill in error_type , crash_function and crash_line at the end of the program, then fix the bug on that line so the program prints: Average: 695.0 K Fix the…
Article Mini projects
…Python random module - our cosmic dice Our solar system data - our possible destinations Let's start by importing our space navigation tools: import random First, let's create our solar system…
Challenge
…readings to the flight computer as text, the way most data arrives from files, forms and networks. The code that adds them up looks right, but the total it prints makes no sense. Predict what it…
Article Python Fundamentals
…Software Development : Build applications and services Data Science : Analyze complex data sets AI/Machine Learning : Create intelligent systems Automation : Streamline business processes Web…
Example
Parameters allow passing data to functions. Functions become more flexible.
Challenge
…split() gives text, so "412.5" + 273.15 would stop with a TypeError . Turn the value into a number, show it with its unit, and add the temperature in kelvin, with two decimal places: Time…
Challenge
…thing any program does with it is turn that text into data. Do that step yourself with the json module, then deal with a response that didn't arrive in one piece. json.loads() The prints from "API…
Challenge
Engineers check averages all day: three spot readings typed by hand, a whole pass from the database, sometimes just two numbers. A function that wants a list makes every one of those calls a little…