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
def geolocation(landmark): | |
if landmark == "Eiffel": | |
return 48.858093, 2.294694 | |
elif landmark == "Statue": | |
return 40.689247, -74.044502 | |
elif landmark == "Opera": | |
return -33.858611, 151.214167 | |
else: | |
return 0, 0 |
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
def pront(prompt, message): | |
userinput = input(prompt) | |
outputmessage = f"{message} {userinput}!" | |
print(outputmessage) | |
pront ("Please enter your name: ", "Hello,") |
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
def pront(prompt, message): | |
print(f"{message} {input(prompt)}!") | |
pront ("Please enter your name: ", "Hello,") |
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
import sys | |
from collections import defaultdict | |
import urllib2 | |
#quit if not python@2 | |
if sys.version_info >= (3, 0): | |
sys.stdout.write("Sorry, requires Python 2.x, not Python 3.x\n") | |
sys.exit(1) | |
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
def quicksort(p_list): | |
""" | |
Quicksort using comprehension and recursion on a list. | |
""" | |
if len(p_list) < 1: | |
return p_list | |
center = p_list[len(p_list) // 2] |
NewerOlder