Last active
October 16, 2020 18:35
-
-
Save mgburns/e837cb1d33612b87abd32224b09157ed to your computer and use it in GitHub Desktop.
A lil' fun with the Python REPL
This file contains hidden or 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
# Basic expressions | |
1 + 1 | |
# Variables, strings, and tuples | |
knock_knock = "Who's there?" | |
knock_knock | |
knock_knock_joke = ("Interuppting Cow", "Interupting co-", "MOO!!") | |
call, response, punchline = knock_knock_joke | |
knock_knock | |
call | |
response | |
punchline | |
# Lists and slices | |
todo_list = ["Come up with a Friday Share", "Keep children alive", "Survive 2020"] | |
todays_todos = todo_list[0] | |
todays_todos | |
later_problems = todo_list[1:] | |
later_problems | |
# Maps, functions, and module imports from the standard library | |
awesome_people_by_first_name = {"Mike": ["Burns", "Pelletier", "Swartz"], "Siri": ["Du Pont-Hurley"]} | |
from random import choice | |
def who_is_the_best_person_named(first_name): | |
print(first_name, choice(awesome_people_by_first_name[first_name])) | |
who_is_the_best_person_named("Mike") | |
who_is_the_best_person_named("Siri") | |
# Funny | |
import this | |
from __future__ import braces | |
import antigravity | |
# But also useful | |
help() | |
keywords | |
topics | |
NONE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment