Example
Text Formatting with f-strings
F-strings are a modern way to format text in Python. Insert variables directly into text.
Showing 1–10 of 84
Example
F-strings are a modern way to format text in Python. Insert variables directly into text.
Challenge
…instead of firing. Predict it, find out why, compare the text instead, then read yes/no settings typed by hand.
Challenge
…out what crew + "1" gives when you type 4, and store it as text in text_sum . Run print(crew + "1") to check, and remove that line before you check. Modify. Fix the program with int() , so that for 4…
Example
How to create text and join it in Python. Basics of working with strings.
Challenge
…worked on a ready-made dict, but the API really sends JSON text. Turn it into a dict with json.loads(), see what false and null become, then handle a response cut off in transfer.
Challenge
Turn the day's mission summary dict into JSON text with json.dumps() and indent=2, see what True, False and None become, then keep the station's Polish letters readable and sort the keys so the files…
Challenge
…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().
Challenge
A 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.
Challenge
…investigate and extend a mission config held in variables: text, whole numbers, decimals and True/False. A PRIMM challenge on Python data types.
Challenge
A sensor packet mixes text, numbers and text that only looks like numbers. Predict what type() shows, find the values that need converting, then convert a packet yourself.