Readings that won't add
Two sensor readings add up to 12080 instead of 200 because they arrived as text. Predict it, find out why and fix it with int(), then add decimal readings with float().
Start the challengePractise what this example shows with these challenges.
Two sensor readings add up to 12080 instead of 200 because they arrived as text. Predict it, find out why and fix it with int(), then add decimal readings with float().
Start the challengeA status line crashes with a TypeError because it joins text and a number with +. Predict it, read the error, fix it with str(), then build a docking status line.
Start the challengeint() cuts the decimals off, round() rounds, and round(2.5) gives 2. Predict the difference, investigate Python's rounding rule, then round a fuel reading two ways.
Start the challengeAsk for an engine burn length with input(), turn it into a number with float() and work out the propellant it uses, then read the tank level too and show what the burn leaves.
Start the challengeA crew count read with input() crashes when 1 is added to it. Predict the crash, find out what input() really returns, fix it with int(), then write a packing tool that reads two numbers.
Start the challengeStuck on this example or want to go further? Ask here, or see what others asked.
Log in to ask and reply.
Separate arguments with commas. They're passed on every Run as sys.argv[1:].
Log in or create a free account to save your code and share it with a link. Your code will be waiting here when you come back.