- compute 10+90
- put the result
fox = "the quick brown fox jumped over the lazy dog"
fox.upper().endswith("lazy dog")
"DOG" == "dog"
mylist = ["one", "two", "three"]
result = " ".join(mylist)
print(result)
result
type(mylist)
type(result)
len(mylist)
len(result)
"sdklfjhasdlkfh"
["f.xd,ghdflskjgh", 10, 100, 0.5, "hewllo"]
song = """Yeah yeah yeah yeah yeah
Yeah yeah yeah yeah yeah yeah
I think I did it again
I made you believe we're more than just friends
Oh baby
It might seem like a crush
But it doesn't mean that I'm serious
'Cause to lose all my senses
That is just so typically me
Oh baby, baby
Oops, I did it again
I played with your heart, got lost in the game
Oh baby, baby
Oops, you think I'm in love
That I'm sent from above
I'm not that innocent
"""
print(song)
words = song.split(' ')
len(words)
words[0]
words[7] = "boom"
words[14] = "boom"
words[21] = "boom"
words[28] = "boom"
words[35] = "boom"
print(words)
songboom = " ".join(words)
print(songboom)
print(song.replace('i', '1').replace('e', '3').replace('s', '5'))
"the quick brown fox jumped over the lazy dog".replace("the", "da")
{}
[]
cities = {
"israel" : "jerusalem" ,
"uk" : "london",
"russia" : "moscow"
}
cities
cities['israel']
cities["france"] = "paris"
print(cities)
cities['france']
leet = {
'i' : '1',
'e' : '3',
's' : '5'
}
synonyms = {
"good" : ['great', 'amzing', 'wonderful', "not bad"],
"sad" : ['blue', 'depressed', 'down', 'gloom']
}
synonyms['sad']
create a dictionary that maps the name of cheeses to prices of 100mg of that cheese.
gouda costs 4.99
Edam costs 2.45
Camambert costs 7.75
Bree costs 7.27
without using “head math”, compute the costs of gouda, edam and camambert together
cheese = {
"gouda" : 4.99,
"edam" : 2.45,
"camambert" : 7.75,
"bree" : 7.27
}
cheese["gouda"] + cheese['edam'] + cheese['camambert']
[cheese["gouda"] , cheese['edam'] , cheese['camambert']]
cheese.keys()
cheese.values()
cheese.items()
sorted(cheese.items(), key=lambda pair: pair[1])[0]
cheese.pop('gouda')
cheese
{
}