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
people = { | |
"sam": 1984, | |
# ... | |
} | |
def getAge(dob): | |
return 2019 - dob | |
ages = [getAge(dob) | |
for name, dob in people.items() |
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
people = { | |
"sam": 1984, | |
"david": 1990, | |
"stephanie": 1992, | |
"helen": 1986, | |
"kate": 1987 | |
} | |
#list of the ages of everyone older than 30 |
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
print("hello") | |
a = [1, 15, 94, 13, 12, 11, 5, 22, 65] | |
b = 3 * 2 | |
def printNums(): | |
for n in range(9): | |
if n > 5: | |
print(a[n] + b) |
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
print("hello") | |
a = [1, 15, 94, 13, 12, 11, 5, 22, 65] | |
b = 3 * 2 | |
def printNums(): | |
for n in range(9): | |
print(a[n] + b) | |
printNums() |
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
print("hello") | |
a = [1, 15, 94, 13, 12, 11, 5, 22, 65] | |
b = 3 * 2 | |
for n in range(9): | |
print(a[n] + b) | |
for n in range(9): | |
print(a[n] + b) |
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
print("hello") | |
a = [1, 15, 94, 13, 12, 11, 5, 22, 65] | |
b = 3 * 2 | |
for n in range(9): | |
print(a[n] + b) | |
print ("goodbye") |
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
print("hello") | |
a = [1, 15, 94, 13, 12, 11, 5, 22, 65] | |
b = 3 * 2 | |
if b > 3: | |
print (a[b]) | |
else: | |
print("too small") | |
print ("goodbye") |
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
print("hello") | |
a = [1, 15, 94, 13, 12, 11, 5, 22, 65] | |
b = 3 * 2 | |
print (a[b]) | |
print ("goodbye") |
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
import pyowm | |
owm = pyowm.OWM('{API-KEY}') | |
observation = owm.weather_at_place('London,uk') | |
w = observation.get_weather() | |
w.get_wind() | |
w.get_humidity() |
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
x = 1 | |
if x == 1: | |
# indented four spaces | |
print("x is 1.") |
NewerOlder