Tested with: Python 3.7.1
True or True or not False and False
What does that print?
Go ↓ for solution or → for next question
True
print(1 + 1.0)
2.0
print("dammit im mad"[::-1])
dam mi timmad
list_a = [1, 2, 3] l = [ [a**2, a**3] for a in list_a] print(l)
[[1, 1], [4, 8], [9, 27]]
d = { ('foo', 100), ('bar', 200), ('baz', 300) } print(type(d))
>>> print(type(d)) <class 'set'>
# set() vs. dict() # # Dict: d = { 'foo': 100} d['foo'] = 200 # Set: d = { 'foo', 100} d['foo'] = 200
x = [ 'a', 'b', { 'foo': 1, 'bar': { 'x' : 10, 'y' : 20, 'z' : 30 }, 'baz': 3 }, 'c', 'd' ]
How to access the value 30?
print(x[2]['bar']['z']) 30
def Foo(x): if (x==1): return 1 else: return x+Foo(x-1) print(Foo(4))
10
g = map(lambda x: "Happy Birthday to " + ("you" if x != 2 else "dear Björk"), range(4)) for line in g: print(line)
Happy Birthday to you Happy Birthday to you Happy Birthday to dear Björk Happy Birthday to you
By Stefan Antoni
A little pop quiz for the python user group ffm