BigSteve/Python/010_formatoutput.py

14 lines
468 B
Python

# Basic example of formatting output printed to the console
# Get the user's age
age = input("How old are you?: ")
# Print a blank line
print()
# Show the user what they typed
# the "f" before the quote means that this string is "formatted"
# Formatted strings can use curly bracket notation to embed
# variables inside a string. This is handy as it handles variable
# type conversion automatically (i.e. integer to string)
print(f"You are {age} years old!")
print()