Created
October 5, 2019 04:01
-
-
Save adrianmarkperea/6cf2e8b162a2c2e4e18a85104c2231e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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