Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Let's create a madlib
year = 2016
event = 'a party with Barrack Obama'
adverb = 'hella'
adjective = 'amazing'
# No, that's not a typo.
# Add 'f' before your strings to make them into f-strings
print(f'It was back in {year} when we had {event}. It was {adverb} {adjective}.')
# => It was back in 2016 when we had a party with Barrack Obama. It was hella amazing.
# For users of Python versions older than 3.6
# Use string formatting
print('It was back in {} when we had {}. It was {} {}.'.format(year, event, adverb, adjective))
# => It was back in 2016 when we had a party with Barrack Obama. It was hella amazing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment