1 + 1 - 2
3*2
1 / 2
3**2
-1**2
3 * (3 - 2)
3 * 3 - 2
?
help()
help(sum)
sum?
sum??
1
2
3.1425
1000
1e-10
a = 5
a
b = 10
c = (a + b) * (a - b)
c
'Hello'
"5"
'[ exp(3) - 16]'
"World"
'"a quote"'
string1 = "Hello"
string2 = "World"
string1 + ' ' + string2
5 * (string1 + ' ')
string1 ** 5
string1.upper()
string1.startswith('h')
'This is a sentence that we will split at the spaces'.split(' ')
["some text", 5, ["another", "list"], (2,2)]
list1 = ['train', 'car']
list2 = ['bike', 'skates']
list1 + list2
5 * list1
list1 - list1
list3 = list1 + list2
list3
list3.sort()
list3
set_of_cities = {'Washington, D.C.', 'Bogotá', 'Berlin', 'Dallas'}
set_of_cities
set_of_capitals = {'Washington, D.C.', 'Bogotá', 'Berlin'}
set_of_capitals
set_of_cities.difference(set_of_capitals)
set_of_cities.intersection(set_of_capitals)
artist_best_album = { 'Depeche Mode':'Violator',
'U2':'Achtung Baby',
'Brooklyn Funk Essentials':'In the Buzz Bag',
}
artist_best_album
artist_best_album['U2']
top_bands = {'The Beatles':{'John':["vocals", "guitars", "keyboards", 'harmonica', "bass",
"(1960–1969; died 1980)"],
'Paul':["vocals", 'bass', 'guitars', 'keyboards', 'drums', "(1960–1970)"],
'George':["guitars", 'vocals', 'sitar', 'keyboards', 'bass',
"(1960–1970; died 2001)"],
'Ringo':["drums", 'percussion', 'vocals', "(1962–1970)"]
},
'The Rolling Stones':{'Mick':["lead and backing vocals", 'harmonica', 'rhythm guitar',
'percussion', 'keyboards', 'bass guitar', "(1962–present)"],
'Keith':['rhythm and lead guitars', 'bass guitar', 'keyboards',
'percussion', 'backing and lead vocals', '(1962–present)'],
'Ronnie':['lead and rhythm guitars', 'bass guitar', 'backing vocals',
'(1975–present)']
}
}
top_bands['The Beatles']
top_bands['The Beatles']['Ringo']
string1[1]
list(set_of_capitals)[-1]
favorite_artists = ['Frank Ocean', 'Steve Lacy', 'Don Toliver', 'Travis Scott', 'Tame Impala', '21 Savage', 'Drake', 'Kali Uchis', 'Kendrick Lamar', 'Kanye West']
list1 = favorite_artists
favorite_songs = ['Pyramids','Dark Red','No Pole','Telekinesis','Eventually','Major Distribution','Passionfruit','Dead To Me','Money Trees','Runaway']
list2 = favorite_songs
artists_best_song = {
'Frank Ocean': 'Nights',
'Steve Lacy': 'Dark Red',
'Don Toliver': 'No Idea',
'Travis Scott': 'SICKO MODE',
'Tame Impala': 'The Less I Know the Better',
'21 Savage': 'a lot',
'Drake': 'Hotline Bling',
'Kali Uchis': 'After The Storm',
'Kendrick Lamar': 'Alright',
'Kanye West': 'Stronger'
}
favorite_artists = ['Frank Ocean', 'Steve Lacy', 'Don Toliver', 'Travis Scott', 'Tame Impala', '21 Savage', 'Drake', 'Kali Uchis', 'Kendrick Lamar', 'Kanye West']
favorite_songs = ['Pyramids', 'Dark Red', 'No Pole', 'Telekinesis', 'Eventually', 'Major Distribution', 'Passionfruit', 'Dead To Me', 'Money Trees', 'Runaway']
favorite_song_artist = dict(zip(favorite_songs, favorite_artists))
print(favorite_song_artist)