This Python Built-in Functions lesson is for a beginner. Read the short notes, run each example, then change one name or number and run it again.
len, type, int, str, float, range, sum, min, max, abs, round, sorted, enumerate, zip, and print are the built-ins you will call most.
They are always available. You do not import them.
Example 1: Start here
enumerate pairs each item with a count. zip walks two lists together.
print(sum([71, 82, 90])) # add the numbers together
print(list(enumerate(["Python", "SQL"], start=1))) # name= sets that argument by its name
Example 2: Store the idea in a name
Python Built-in Functions begins with a value you can point at. The name topic holds that text.
topic = "Python Built-in Functions" # text
print(topic)
Example 3: Check it with if
An if chooses one branch. Change the score and run it again to see the other message.
score = 21 # a whole number
if score >= 80: # run the indented lines only when this is true
print("Pass")
else: # runs when the test above was false
print("Try again")
Example 4: Repeat with a loop
A for loop runs the indented line once per step. The numbers 1, 2, and 3 are printed on their own lines.
for step in range(1, 4): # repeat once per number; range stops before the last
print("Step", step) # a comma prints each value, with a space between
