#Python - How does this even work
9 messages · Page 1 of 1 (latest)
@orchid crane
✅ Exec - Success (Super User 🦸)
<
g
e
n
e
r
a
t
o
r
o
b
j
e
.
.
Removed 36 lines
.
.
0
x
7
f
0
3
9
e
e
1
0
3
c
0
>
!exec modules | Completed in 0.0794 milliseconds
wtf
The generator is lazy, so it's never actually running the code, you'll get an error saying dictionaries aren't callable as soon as you try to iterate the generator.
Oh that does make sense
!exec ```py
mapping = {
'1': 'I',
'2': 'Z',
'3': 'Z',
'4': 'H',
'5': 'S',
'6': 'G',
'7': 'L',
'8': 'B',
'9': '-',
'0': 'O'
}
def turn_calc(numbers: int) -> str: # broken
return next(mapping(n) for n in str(numbers))
for i in turn_calc(7284):
print(i)
@sleek monolith
❌ Exec - Exception Raised
Traceback (most recent call last):
File "<string>", line 15, in <genexpr>
TypeError: 'dict' object is not callable
!exec modules | Completed in 0.2922 milliseconds