#off-topic-lounge-text
1 messages · Page 35 of 1
I could if we lived in scotland
Don't ask me but I love that post
That like resonated with my ear drum
It made me puke from fear when I was a kid
Okay that's gold
Didn't even know that was a thing
ET?
🤢
Ohh
Yeah it's great
Did you watch BB first?
Ah :C
Yeah it really picks up from there
Season 2 and the beginning of season 3 are a bit slow.
Season 4 is amazing.
The guy
What you working on at the moment?
Very nice
Iterative design
That guy's got a stick of dynamite yeah
Wow my terminal is taking like 30 seconds to start up for some reason 🤔
Keep getting disconnected S:
Just make your font really small.
You know systemd can watch files btw Griff.
I didn't hear the entirety of what you were saying earlier so I don't know if that's actually a helpful suggestion but 🤷♂️
Ah right
inotifywait
Waits for changes to one or more files.
More information: https://manned.org/inotifywait.
- Run a command when a file changes:
while inotifywait {{path/to/file}}; do {{command}}; done
- Be quiet about watching for changes:
while inotifywait --quiet {{path/to/file}}; do {{command}}; done
- Watch a directory recursively for changes:
while inotifywait --recursive {{path/to/directory}}; do {{command}}; done
- Exclude files matching a regular expression:
while inotifywait --recursive {{path/to/directory}} --exclude '{{regular_expression}}'; do {{command}}; done
- Wait at most 30 seconds:
while inotifywait --timeout {{30}} {{path/to/file}}; do {{command}}; done
- Only watch for file modification events:
while inotifywait --event {{modify}} {{path/to/file}}; do {{command}}; done
No description provided.
😔
@buoyant kestrel
Project Structure
templates/ # Holds template.yml files that define the output structure of guild channels
README.md # What you are reading
notes.txt # Implementation notes
structure.yml # Holds the ... ?
Like ```py
def foo(
x,
y,
z,
):
...
@steady gust could you turn on PTT, you've got some background noise.
let us know when you have sorted it, and we can unmute ^
I really like most of the decisions made by Black tbh.
I really like most of the decisions made by Black tbh.
And where I disagree with it, I'm happy that it's at least consistent and I don't have to think about it.
And where I disagree with it, I'm happy that it's at least consistent and I don't have to think about it.
run.py lines 13 to 18
await send(
{
"type": "http.response.start",
"status": 404,
}
)```
Gimme a sec KJ 🤔
run.py lines 13 to 18
await send(
{
"type": "http.response.start",
"status": 404,
}
)```
Gimme a sec KJ 🤔
run.py lines 13 to 18
await send(
{
"type": "http.response.start",
"status": 404,
}
)```
Is it just me or is Discord slow to send messages atm?
so
foo123 valid
foo valid
123 not valid
123foo valid
So, at least one alphabetic character?
yes
.*[a-z].*
They've turned on slow mode :C
@wide aurora
Should be.
Let me test it...
Let me test it...
Ah right
ah I see
Think it's more explicit.
I never remember exactly which characters \w (and similar) correspond to.
But, just personal preference 🤷♂️
!eval ```py
import re
valid_strs = """
foo123
foo
123foo
foo123bar
""".splitlines()
invalid_strs = """
123
""".splitlines()
pattern = re.compile(r".[a-z].")
for s in valid_strs:
assert pattern.fullmatch(s), s
for s in invalid_strs:
assert not pattern.fullmatch(s), s
print('success')
@cold lintel :white_check_mark: Your eval job has completed with return code 0.
success
Alright, reading Fisher's code...
Oh on the commits page the oldest commit is first. Was reading them in the wrong order. Was confused.
Yep
Mhm
Ah yeah, one sec...
Simplified and community-driven man pages
Erm, it's more like a community maintained list of examples.
Yep
It's pretty good
Nah it just says not found.
I find it really useful, because terrible memory.
Adios @vernal snow
Cya guys 👋
hello
wish = input('Enter what you would like:')
if wish == 'cream':
print('Try the cream puffs')
if wish == 'raisins':
print('Try our signature cakes')
if wish == 'cream'or wish != 'raisins':
print('Try the poppy seed crescents')
can u fix it for me plz
!eval
code
!eval <code>
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
!eval wish = input('Enter what you would like:')
if wish == 'cream':
print('Try the cream puffs')
if wish == 'raisins':
print('Try our signature cakes')
if wish == 'cream'or wish != 'raisins':
print('Try the poppy seed crescents')
!eval
wish = input('Enter what you would like:')
if wish == 'cream':
print('Try the cream puffs')
if wish == 'raisins':
print('Try our signature cakes')
if wish == 'cream'or wish != 'raisins':
print('Try the poppy seed crescents')
@hearty cobalt :x: Your eval job has completed with return code 1.
001 | Enter what you would like:Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
why ur not speaking
.
oh that bad
yeah
Perhaps, were you to narrow your eyes at it accusingly, it would begin to function.
Howdy howdy.
your mic also bugged
I'm not speaking.
and why
I'll set myself to mute to remove doubt.
this is overload self-confident LOL
About the closest thing I've ever done in terms of writing an API was the most janky, slapdash cobbling together of Twisted code to distribute some Mandelbrot animation processing.
I like Twisted. It's higher level than requests and the like, so it's a bit friendlier to use.
building Rpg
?
What is life but a series of often contiguous dumb things?
sofi asked us about the projects
yes
Agreed.
kemal wher
its a mod of peglin, building it in python
kemal where are u from
Macedonia
nice
So, sort of a Pinball/Pachinko thing, but...RPG. Hm.
or turkeyü
yes a was thinking about creating a roulette to mix game genres
no just macedonia
yep
unless baklava
baklava is a greek food
hey all we have geography lesson today by KEmal and Iam hungry
you are a traitor
Moderate continental climate in Macedonia
It usually has cold and wet winters and hot dry summers. Spring is colder than Autumn. There are differences in average temperatures in regions of moderate continental climate. These differences are due to the geographical width of the regions, the height of the sea level, etc. due to locations. its not ctrl+v
how i unlock my mic on this server
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
tree = hotel
i sure that this is ctrl+ v
https://en.wikipedia.org/wiki/Burning_Mountain @worn gulch
i dont have the requirements 😭
where you learn english
bro do you know what joke is
yeah i know it and also iam joking
in school
nice
and also ı am 12
so do you want to eat
afaik you can't use discord and be under 13 years old
but you can fake your birthday
yes
whats your point
and in 2022 kids can do any thing they want
my point in waht??
!rule 2
2. Follow the Discord Community Guidelines and Terms Of Service.
using discord under age 13 is against ToS
so what shoud ı do
so tell me how do you know that this man here is 12 yo
unless you see him
because he openly admitted to being 12
thanks @dry sequoia
you'r free here
its against the rules what don't you understand
i dont folow rules
and ı love fenrir in mythology
cool
thats like saying I don't obey the law
I'm not used to seeing dark theme on github.
how a kid 12 yo know the word of mythology
WHY
so you'r genus kid
Because I only visit it casually.
no
ok fair point
ı am jusy a normal kid
but still
there is a defrent between law and rules
the law is just a set of rules for a country
People who prefer light themes should be launched toward the sun into which they stare.
yes
dont they already live on the sun tho
I sometimes switch to lightmode just to change things up a bit 😄
But it only really works when you're outside or in a room with a lot of sunlight.
rules are personal in nature, and they are often adjusted as the conditions and circumstances of the home change. Laws must be passed through due process in order to take effect. A law starts off as a bill, and must go through a series of checks, balances, and votes in order to become a law.

@dry sequoia my mom is math prof. maybe thats why ı read books
in the end, the law is just the rules all citizens of the country must follow
but thats stupid every kid can read book
Were that only so.
ok that"s your point
Perception of children in 2022 is very different
and that same thing applies to rules, just instead of citizens of the country, it's members of the server
reading books is good for all people
Not every, some
@ruby birch how much time do you spend on this project ?
hey there iawas just kidding about the rules
just to have fun
bye
@forest hamlet
Anyone here?
I'm currently a rookie in Python.
Can you tell me how can I get fluent inPython
It would be really good.
@buoyant kestrel Let me know when you are available I wanted to add the fetures on the Calculator 😊
yo somebody can help me about this assignment idk how to do
Your best bet would be to claim a help channel: #❓|how-to-get-help
okay bro
Ah right, so you are going to parameterise the maximum world level later.
Oh right
A trick is to use max(0, x)
To get a function that looks like this: https://www.desmos.com/calculator/abncirdckd
I would always opt for the API if there is one available @meager bluff
Maybe break the calculation down into two parts.
@meager bluff What's the application?
spoonacular API
Oh right. This is a pretty good guide to working with APIs in python: https://realpython.com/python-api/
Feed yer cat 😄
Ah just a diva cat
Is python a good fit or should I consider using JS for that?
Javascript is very good for interacting with web APIs, but Python is alright.
At least there is decent article about how to use API's in python 🙂
Have you learned about unit testing? @cold crystal
Realpython content is usually pretty good
Ah right. It's a slightly more efficient way to test your code.
After a while, manually testing can get too much.
Erm, it's a pretty general concept. It can be as simple as testing the output for different inputs to your function.
def test_addone():
assert addone(1) == 1
assert addone(2) == 3
There are tools you can use to run tests, like pytest.
Yeap
!eval ```py
assert 1 == 2
@cold lintel :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | AssertionError
Heading over to the other channel 👋
Maybe you know a super easy to use API?
@cold crystal make async
@cold crystal can you hear me ?
what are you guys doing in the channel
!stream 491289245974003722 "1 hour"
✅ @cold crystal can now stream until <t:1651959237:f>.
i am new to python learner, any best notes are available
who does here javascript
:incoming_envelope: :ok_hand: applied mute to @violet zephyr until <t:1652187885:f> (9 minutes and 59 seconds) (reason: burst rule: sent 8 messages in 10s).
:incoming_envelope: :ok_hand: applied mute to @primal bison until <t:1652187958:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
Alice and Bob are fictional characters commonly used as placeholders in discussions about cryptographic systems and protocols, and in other science and engineering literature where there are several participants in a thought experiment. The Alice and Bob characters were invented by Ron Rivest, Adi Shamir, and Leonard Adleman in their 1978 paper ...
.xkcd 177
Yeah can be hard to keep track of what the current state of a Jupyter notebook is.
What I normally do when it gets messy is re-evaluate the whole notebook from the start ("run all").
lambda: 'black' is equivelant to:
def function():
return 'black'
Who wants to join me in putting a paperclip into a power supply cable
!stream 878427445110407218
✅ @fallen gulch can now stream until <t:1652202629:f>.
Fine, brief puppy break
hmm
:(
Thank god i use USDT
and then nerds like this on Coin Market Cap
Hola
Vowels to be returned as UpperCase Consonants to be return with 3 places shifted among consonants ONLY Remaining All special characters will be same
i want to write python code on above given conditions ... please help me out
let's go...
where are you at now
I know python pretty well...
that's the only lang, I know properly...
yeah..
almost 4 years...
properly from 2 years
i'm a cs major...
what...
I didn't get you
in india it is always hot...
in most places
lowest is 25* C
summers go as high as 40
yeah...
yeah
shift enter
it's ipynb...
ig, debugger only works with .py files
have you tried shift enter..
reopen vs code
just open jupyter notebook
syntax
you need to quote of someone
no in the same string
!e
print("Hello, mr.singlequote "'" "
@icy raven :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print("Hello, mr.singlequote"'""
003 | ^
004 | SyntaxError: unterminated string literal (detected at line 1)
there is none...
if your string has single quote.. use double quotes to wrap it... if your string has double quote... use single quote to wrap it..
otherwise... whichever you prefer
!e
print("hello\bhi")
@icy raven :white_check_mark: Your eval job has completed with return code 0.
hellohi
click on try it @fresh sail
don't ever use this...
maybe there remove it let me see...
we have unicode now
for legacy stuff
reallyyyyyyyyyy old legacy stuff...
no... when they use to use computer with printers @fresh sail
no display
we use to just type out stuff...
each is 8 bits...
it is unicode stuff
@fresh sail ...
yeah
powers of 2
click on try this
o represents... o is a placeholder for octal
h is a placeholder for hexadecimal
yeah...
\x[somehex]
\x represents is hex
\x82
we wasted too much time on legacy stuff
print(0x22)
!e
print(0x22)
@icy raven :white_check_mark: Your eval job has completed with return code 0.
34
!e
print(0b11)
@icy raven :white_check_mark: Your eval job has completed with return code 0.
3
!e
print(0o55)
@icy raven :white_check_mark: Your eval job has completed with return code 0.
45
they use hex stuff for colors very often..
you teaching python?
yep
we are reading this book https://automatetheboringstuff.com/2e/chapter6/
and people write assembly (if there are any left)... in hex
awesome I'll try to be there
but for anything complicated... cpp compiler writes better assembly than most people...
c++
or rust complier...
f is for formatting
you should look for difference between normal string and r string
f string and r string is not a right comparison...
yeah.. f string behaves like normal string... with formatting
@glossy trail We are over here
so correct comparison is r strings and normal strings...
if you don't have any variables f string is just normal string..
flower brackets
f"{spam}"
print(r'\nhello')
output:
\nhello
normal:
print('\nhello')
output:
<empty line>
hello
!e
x = 1
print(f"{x}")
@icy raven :white_check_mark: Your eval job has completed with return code 0.
1
!e
x = 10
print(f"{x}")
print(f"{x = }")
print(f"{x = }")
print(f"{x:b}") # this is binary format
print(f"{x:x}") # hex.. like that..
print(f"{x = :o}")
@icy raven :white_check_mark: Your eval job has completed with return code 0.
001 | 10
002 | x = 10
003 | x = 10
004 | 1010
005 | a
006 | x = 12
how do I print colored lines?
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
that is octal
I know this, I asked how do I print colored string in command-line using python
sorry first time ive ever joined this, idk whats going on. do you teach stuff and we like try on here? sorry
there are libraries... if i remember correctly there is something called typer
any clue how to do it without external libraries?
idk... let me lookup
https://stackoverflow.com/questions/287871/how-do-i-print-colored-text-to-the-terminal
it will be a pain in the ass...
without lib
looks doable, I'm not a fan of external libraries for tiny tasks.
!e
x = '\033[93m' + 'hello' + '\033[0m'
print(x)
@icy raven :white_check_mark: Your eval job has completed with return code 0.
[93mhello[0m
it's not working here..
this wont work here
for docs strings it is needed imo.. even if it is obvious...
def spam():
"""says hello"""
print("hello")
this is good because, it gives that hover effect...
def spam():
print("hello") # this says hello
this is bad
@indigo kite
when you say
s[-1]
it just assumes
s[len(s) - 1] @fresh sail
that's reverse
only for lists
that's for lists
because strings are immutable
as far as i know, this is the way
cpp has something
@fresh sail @indigo kite someone sent me this today
c++ has something like
s.end()
wait how do you use the multi-cursor?
elon is quite inconsistent with his thoughts about twitter... which is concerning...
haha
!e
a = list(range(10))
print(a[1::2])
@icy raven :white_check_mark: Your eval job has completed with return code 0.
[1, 3, 5, 7, 9]
!e
a = list(range(10))
print(a[0:6:2])
@icy raven :white_check_mark: Your eval job has completed with return code 0.
[0, 2, 4]
!e
print(*range(5))
@icy raven :white_check_mark: Your eval job has completed with return code 0.
0 1 2 3 4
@fresh sail
we are just unpacking range yield values and giving it print
it is like empty set is a subset of every set
@indigo kite
if it happens... we will not be surprised!
!e
a = []
a += 1
@icy raven :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | TypeError: 'int' object is not iterable
'' in [1,2,3,"aaa"]
is false
!e
a = []
a += "1"
print(a)
@icy raven :white_check_mark: Your eval job has completed with return code 0.
['1']
something that is gonna spoil python for you @indigo kite @fresh sail
read this
it is not appending intergers... right...
@icy raven :white_check_mark: Your eval job has completed with return code 0.
['h', 'e', 'l', 'l', 'o']
me neither... as I said
yeah... it's good...
!e print("test")
@wheat bane :white_check_mark: Your eval job has completed with return code 0.
test
it is C way of doing thing... f strings are better
!e
test = []
test += 10293022
@primal bison :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | TypeError: 'int' object is not iterable
!e
test = []
test += 10,10
@primal bison :warning: Your eval job has completed with return code 0.
[No output]
!e
test = []
test += 10,10
print(test)
@primal bison :white_check_mark: Your eval job has completed with return code 0.
[10, 10]
!e
test = []
test.append(1,0,1)
print(test)
@primal bison :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | TypeError: list.append() takes exactly one argument (3 given)
people who write c code... might prefer it...
ahh i see
@fresh sail
doing format after declaring string is bad, imo... what if we don't have that variable price...
!e "my name is {name}".format(name="mike")
@wheat bane :warning: Your eval job has completed with return code 0.
[No output]
you need to print it
!e print("my name is {name}".format(name="mike"))
@wheat bane :white_check_mark: Your eval job has completed with return code 0.
my name is mike
I was saying that to mohtasim
!e print("my name is {name} and my age is {age}".format(name="mike", age=100))
@wheat bane :white_check_mark: Your eval job has completed with return code 0.
my name is mike and my age is 100
!e print("{b}".format(b=10))
@wheat bane :white_check_mark: Your eval job has completed with return code 0.
10
never mind both are run time errors...
if they wanted to... they could have easily made it into compile time error...
isupper() is more like is_not_lower
@fresh sail
no...
saying what it means
isupper means none of the letters should not be lower...
not everything has to be upper case
to make every character lower
to check if input string is blank...
user are unpredictable.... they might press some space and press enter...
space come from whitespace, ig
!e dir(str)
@wheat bane :warning: Your eval job has completed with return code 0.
[No output]
!e print(dir(str))
@wheat bane :white_check_mark: Your eval job has completed with return code 0.
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
dir(str)
what is snake case
will show all the method of string
i can't speak on the live-coding why?
yes
isSomethig is camel case
I think snakecase is better camel case...
but I hate python standard lib is non consistent with it
why not
is_upper()
why is it list not List
Rust style is perfect...
snake case is for functions and variables
Camel case for classes and all
I think it is a reference to hitch hikers guide to the galaxy
select detect laguage
remove the question mark
https://github.com/OrkoHunter/python-easter-eggs
@fresh sail
Today, I realized we don't have linux emojis in pydis
we have f-ing notion
and vs code insider release logo 🤦♂️
but not linux
no
🐧
omar doesn't mean age it's a name from a guy he was a friend of Prophet Mohammed and it has a different pronunciation
umar right?
nice
@fresh sail sorry to disturb, do you do these at set times every day? i need to go but this is really cool!
kek
it's a worse time for me 😦 currently it's 11:20pm
yes
that's my bed time too lol
have you seen dr. normal in the universe of sane @leaden drift
well I know good amount of python I was just enjoying your voice
🙂
.join is very useful
only list of strings
add .split() at the end
!e print("cats"+"bats")
@wheat bane :white_check_mark: Your eval job has completed with return code 0.
catsbats
🤣
join and split together is useless
- can be used to concat two string
you got trolled bro stop
!e
s = "hey hi hello"
print("-".join(s.split()))
@icy raven :white_check_mark: Your eval job has completed with return code 0.
hey-hi-hello
.split('-')
!e
s = 'hey hi hello'
print(s.replace(' ', '-'))
@potent crow :white_check_mark: Your eval job has completed with return code 0.
hey-hi-hello
but i only use join to print a list in some format...
!e print("hey hi hello".replace(" ","-"))
@wheat bane :white_check_mark: Your eval job has completed with return code 0.
hey-hi-hello
❤️
@leaden drift :white_check_mark: Your eval job has completed with return code 0.
catsratsbats
!e
nums = list(range(7))
print(" ".join(str(x) for x in nums))
@icy raven :white_check_mark: Your eval job has completed with return code 0.
0 1 2 3 4 5 6
that's the only thing I ever use join for........
You can always just do a cheeky "-".join(map(str, ...))
I like comprehension better...
same
no no that was earlier when you copied @calm bay example
yes
do nvidia make linux driver opensource? or the kernel module opensource?
In some cases map is more succint and I prefer it
map(f,...)
(f(x)for x in ...)
driver is still closed source
If you're using map with a lambda at that point I prefer a comprehension too
yeah.... I prefer it cause, comprehension is map and more!
fair enough, I just feel cool using map 😅
map + (reduce or filter)
!e print('catsratsbats'.partition('s'))
@leaden drift :white_check_mark: Your eval job has completed with return code 0.
('cat', 's', 'ratsbats')
I don't know..... I'm feeling like this is a video ... I keep pressing right arrow to forward video...
😂
wow the center() was really helpful for me
you might find this useful too: https://www.cs.toronto.edu/~mustafa/python-tips.html

don't pretend like you didn't...
admit it..!!
alright I admit it
@fresh sail look at the resource mustafa sent
.
Not even in the VC and I clicked it
i cannot find a good fuzzy search library
it's pretty easy to implement... https://en.wikipedia.org/wiki/Levenshtein_distance
fuzzy wuzzy will give you the ratio but do not give the location of the sub string match
Gooooootcha
Didn't realize that
to do that you need to that algorithm through all substring, it will take like n^3... (maybe there is better way)
yes it will be too slow
I feel like we can do some optimization... and get it down to n^2
I'll try that tomorrow... and I'll dm you if I could do it..
i think not. because it should have to go through all the variable length substring
i gotta sleep, bye 👋
good night
but try this
alright 🤣 enjoy your day!
lol
🤣
that subtitle really sells it 🙂
strange that the talk is now 10 years old
that's a long time indeed
What are you guy's / gal's working on?
what is this project about, i'm trying to figure out
hello
HI
my discord bot noting else
!e
def resolve(value: int):
if value < 10:
yield value
return
str_v = str(value)
yield from resolve(sum(int(c) for c in str_v))
def resolve_multiple(*values):
for value in values:
yield from resolve(value)
gen = resolve_multiple(10234,23423)
for val in gen:
print(val)
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 5
!e
import asyncio
from asyncio import create_task
async def resolve(value: int):
if value < 10:
return value
str_v = str(value)
await asyncio.sleep(int(str_v[0]))
return await resolve(sum(int(c) for c in str_v))
async def resolve_multiple(*values):
tasks = [create_task(resolve(v)) for v in values]
for result in asyncio.as_completed(tasks):
yield await result
async def main():
async for result in resolve_multiple(321, 42, 5):
print(result)
asyncio.run(main())
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | 5
002 | 6
003 | 6
@wide aurora from os import open? xD

can i speak?
gtg
might be back later
i'm probs gonna try and make a as_completed for async iters
sounds like a fun problem
ty for the brain thoughts
@atomic phoenix
what are you working on
!e
import asyncio
from asyncio import create_task, sleep
from typing import AsyncGenerator
async def as_completed(*async_generators: AsyncGenerator[int, None]) -> AsyncGenerator[int, None]:
"""Get the values of async generators as they are yielded.
Wait for a result from at least one of the async generators.
Then iterate over all the completed tasks, yielding their result.
And then creating the next task to gather a result.
"""
steps = {
create_task(anext(g), name=str(i)) for i, g in enumerate(async_generators)
}
while steps:
done, steps = await asyncio.wait(steps, return_when=asyncio.FIRST_COMPLETED)
for d in done:
try:
yield int(d.get_name()), d.result()
except StopAsyncIteration:
print(f"{d.get_name()}: completed")
else:
steps.add(create_task(anext(async_generators[int(d.get_name())]), name=d.get_name()))
async def f(start: int, end: int) -> AsyncGenerator[int, None]:
"""Example async generator"""
for i in range(start, end):
await sleep(0.01 * i)
yield i
async def main() -> None:
async_generators = [f(5, 10), f(1, 3), f(6, 11)]
# Handle results as they come from the async generators
async for i, result in as_completed(*async_generators):
print(f"{i}: returned {result}")
asyncio.run(main())
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | 5
002 | 1
003 | 2
004 | 6
005 | 7
006 | 8
007 | 9
@atomic phoenix ^

it uglly
but it work
ite
I also might ask in #async-and-concurrency as there probs is a better (stdlib) way to do it
what are you guys building?
what you doing @atomic phoenix
yeah
okay...
why... for fun or for something
@atomic phoenix tell him to change that float to string... ig
hi do u know wen they going to start
start what?
the live_coding
if you are talking about automating the boring stuff... it is only on tuesdays and thursdays, ig
oh ok thx
@calm bay what are the timings....
"relating to or designed for efficiency and comfort in the working environment."
eggs, bacon, spam = 'What is going on, Marty?'.partition(',')
what is bacon after the following lines are executed?
🖐️
ghrqs
!e ```py
import random
li = [1,2,3]
print(li.random.choice)
@empty plover :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 5, in <module>
003 | AttributeError: 'list' object has no attribute 'random'
eh idc
!e
import random
li = [1,2,3]
print(random.choice(li))
@calm bay :white_check_mark: Your eval job has completed with return code 0.
1
@empty plover
!e
code
!e
code
!e
print(“hola qué tal”)
@teal rune :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(“hola qué tal”)
003 | ^
004 | SyntaxError: invalid character '“' (U+201C)
@teal rune :white_check_mark: Your eval job has completed with return code 0.
hola qué tal
!e
input('sexo la pelicula')
@teal rune :x: Your eval job has completed with return code 1.
001 | sexo la peliculaTraceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
A
!e
code
!eval <code>
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
!e
print("hello")
use ```py
what is the best data type in python to implement from it a graph data structure ?
and can I nest dictionary 3 times ?
tryeth and thou shall see. There is no limit as far as I know
!e
code
oops
!e
while True:
print("does this work or nah")
well i guess it technically does
bruh\
hi
I'm not muted, I'm mute
yeah wanna read the boring stuff book?
wait 10 mins if you have time
k brb
Back
no clue, where did you left?
let's continue from there
I have vscode and pycharm, I have good basic knowledge on python. Learning couple of new things from this book.
Bachelors of science?
currently learning assembly to start developing my hobby OS
Nope good 😄 all set

pip install pyperclip
snake_case
camelCase
PascalCase
reverse-cameL-kebaB-casE
AnNoYiNgCaSe
Imma use this for everything now
4:00 PM - 6:00 PM UTC
@calm bay where you at, gurl?
return carriage
I was wrong. I'm thinking of something else. Although there is no strict convention for using either yay or way
So it's just what sounds better in those cases
"every" = "eryevay"
"another" = "otheranay"
"under" = "erunday"
"island" = "andislay"
"elegant" = "egantelay"
i love how the gaming chat program is named discord aka disagreement between people which is very fitting
and the work chat program is named slack which is also very fitting as most people slack off on work o- o
foo = list(range(10))
even_squared_foo = [item_sq for item in foo if (item_sq := item ** 2) % 2 == 0]
^ example of where i might use it (walrus )
@primal bison I love the name and wish it worked xD
ik :(
it said pip is not recognizable :(
@buoyant kestrel record this and make it audiobook with author's permission? 😮
he does but still
EyhayOssbay,Iyayon'tdayowknayatwhayIyayamyayoingday,Iyayamyayustjayollowingfayethayirectionsday
Eyhay Ossbay, Iyay on'tday owknay atwhay Iyay amyay oingday, Iyay amyay ustjay ollowingfay ethay irectionsday
3.1.1.31100128
Runes are the letters in a set of related alphabets known as runic alphabets. Runes were used to write various Germanic languages before the adoption of the Latin alphabet and for specialised purposes thereafter. In addition to representing a sound value (a phoneme), runes can be used to represent the concepts after which they are named (ideogra...
have fun, bye 👋🏽
@rocky charm @buoyant kestrelhttps://semver.org/#spec-item-10 <-- so its build metadata in general but in matt's case its the actual current build number which is similar to how we do it in .Net
!e print("3".isalpha())
@honest pasture :white_check_mark: Your eval job has completed with return code 0.
False
@honest pasture :white_check_mark: Your eval job has completed with return code 0.
True
prefixNonLetters += word[0]
?
!e print(dir(""))
@honest pasture :white_check_mark: Your eval job has completed with return code 0.
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isascii', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'removeprefix', 'removesuffix', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
?
!e print("2.5".isdigit())
@honest pasture :white_check_mark: Your eval job has completed with return code 0.
False
!e print("2.5".isnumeric())
@agile portal :white_check_mark: Your eval job has completed with return code 0.
False
special character to have some function in a string
!e print("2.5".isdecimal())
@honest pasture :white_check_mark: Your eval job has completed with return code 0.
False
isdecimal(self, /)
Return True if the string is a decimal string, False otherwise.A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
I do not understand
tab and endline
/t = tab
/n = newline
newline*
< >
is the \r also the same thing?
oh
double \
isnumeric vs isdigit is the world's dumbest thing
🤣
\\
pretty sure it's in utf-8 encoding when scraping websites
I cannot describe how dumbfounded I am at the differences between isnumeric, isdigit, and isdecimal
Yeah that's thrown me for a loop
the difference is literally just which esoteric unicode characters they support
!e
print(""""hello" 'world'""")
@agile portal :white_check_mark: Your eval job has completed with return code 0.
"hello" 'world'
@carmine current 👋
!e
print("""
hello
this has newlines
""")```
!e
a = ["hello""world"]
print(a)
@icy raven :white_check_mark: Your eval job has completed with return code 0.
['helloworld']
@honest pasture :white_check_mark: Your eval job has completed with return code 0.
001 |
002 | hello
003 |
004 | this has newlines
it'll wipe the line
yes
I agree
i cant spoiler code blocks
discord itself documents that codeblocks count as a spoiler tag ending
def printTable(data):
data = sorted(data, key=len)
for row in data:
for col in row:
print(col,end=' ')
print()
!e
def printTable(data):
data = sorted(data, key=len)
for row in data:
for col in row:
print(col,end=' ')
print()
thank you!
call the func
!e
def printTable(data):
data = sorted(data, key=len)
for row in data:
for col in row:
print(col,end=' ')
print()
tableData = [['apples', 'oranges', 'cherries', 'banana'],
['Alice', 'Bob', 'Carol', 'David'],
['dogs', 'cats', 'moose', 'goose']]
printTable(tableData)
@leaden drift :white_check_mark: Your eval job has completed with return code 0.
001 | apples oranges cherries banana
002 | Alice Bob Carol David
003 | dogs cats moose goose
!e
def printTable(data):
data = sorted(data, key=len)
for row in data:
for col in row:
print(col,end=' ')
print()
printTable()
@potent crow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 8, in <module>
003 | TypeError: printTable() missing 1 required positional argument: 'data'
!e
def printTable(data):
data = sorted(data, key=len)
for row in data:
for col in row:
print(col,end=' ')
print()
printTable('hello')
@potent crow :white_check_mark: Your eval job has completed with return code 0.
001 | h
002 | e
003 | l
004 | l
005 | o
Magic girl you should try 'leek'
!e
code
!eval <code>
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
!timeit print('hi')
@honest pasture :white_check_mark: Your timeit job has completed with return code 0.
500000 loops, best of 5: 631 nsec per loop
think i gotta go now :x i might join back later or on thursday cya guys later :3
bye
!e def printTable(data):
data = sorted(data, key=len)
for row in data:
for col in row:
print(col,end=' ')
print()
printTable('hello')
@primal bison :white_check_mark: Your eval job has completed with return code 0.
001 | h
002 | e
003 | l
004 | l
005 | o
!timeit ([*range(900_000_0)])
!e
code
!eval <code>
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!*
the code is too big
!timeit
from math import sqrt
for n in range(900_000_0):
sqrt(n)
!e
x = 2
while True:
x *= x
@potent crow :warning: Your eval job timed out or ran out of memory.
[No output]
lol
@honest pasture :white_check_mark: Your timeit job has completed with return code 0.
1 loop, best of 5: 877 msec per loop
#bot-commands
!e
import requests
req = requests.get('https://api.myip.com/').json()
print(req)
@potent crow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ModuleNotFoundError: No module named 'requests'
@potent crow :white_check_mark: Your eval job has completed with return code 0.
/snekbox
!e ```py
def printTable(table):
col_l = [len(max(col, key=len)) for col in table]
for row in zip(*table):
print(" | ".join(item.rjust(col_l[i]) for i, item in enumerate(row)))
table = [["aaaaaaaa", "aaa", "a"],["bbb", "bbbbbb", "bb"],["ccc", "cccccccccc", "ccc"]]
printTable(table)
@carmine current :white_check_mark: Your eval job has completed with return code 0.
001 | aaaaaaaa | bbb | ccc
002 | aaa | bbbbbb | cccccccccc
003 | a | bb | ccc
!e
import os
print(os.listdir())
@potent crow :white_check_mark: Your eval job has completed with return code 0.
['Pipfile.lock', 'Pipfile', 'config', 'snekbox', 'user_base', 'tests', 'LICENSE']
!e
import os
os.remove(Pipfile.lock)
@potent crow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | NameError: name 'Pipfile' is not defined
!e
import os
os.remove('Pipfile.lock')
@potent crow :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | OSError: [Errno 30] Read-only file system: 'Pipfile.lock'
okay
#bot-commands
!e
def printTable(data):
n = len(max( max(d, key=len) for d in data))
# print(n)
for row in data:
for col in row:
# print(len(x))
print( " " * (n - len(col)) + col, end= " ")
print()
data = [["hello", "world dddd"], ["hi", "world"]]
printTable(data)
@icy raven :white_check_mark: Your eval job has completed with return code 0.
001 | hello world dddd
002 | hi world
code
!stream 833767295993905242
✅ @mild goblet can now stream until <t:1652810247:f>.
I think furyo is feeling pressured cause alot of people are watching...
!e
data = [i for i in range(4)]
for i in range(len(data)):
print(data[i])
print('part 2')
for i in data:
print(i)
@leaden drift :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 1
003 | 2
004 | 3
005 | part 2
006 | 0
007 | 1
008 | 2
009 | 3
@honest pasture :white_check_mark: Your eval job has completed with return code 0.
[[...]]
... is also pass
!e
a = []
a.append(a)
print(a)
print(repr(a))
@buoyant kestrel :white_check_mark: Your eval job has completed with return code 0.
001 | [[...]]
002 | [[...]]
The same as the ellipsis literal “...”. Special value used mostly in conjunction with extended slicing syntax for user-defined container data types. Ellipsis is the sole instance of the types.EllipsisType type
!e
def printTable(data: list):
a = 0
for row in data:
current_data = ' '.join(row)
if len(current_data) > a:
a = len(current_data)
for i in data:
current_data = ' '.join(i)
print(current_data.center(a,' '))
tableData = [
['apples', 'oranges', 'cherries', 'banana'],
['Alice', 'Bob', 'Carol', 'David'],
['dogs', 'cats', 'moose', 'goose']
]
printTable(tableData)
@leaden drift :white_check_mark: Your eval job has completed with return code 0.
001 | apples oranges cherries banana
002 | Alice Bob Carol David
003 | dogs cats moose goose
for row in data:
for col in row:
...
@leaden drift
I did try that earlier
.
you just printed them in sorted order of the length of each row....
oh
!eol 3.6
!el 3.5
for-else
In Python it's possible to attach an else clause to a for loop. The code under the else block will be run when the iterable is exhausted (there are no more items to iterate over). Code within the else block will not run if the loop is broken out using break.
Here's an example of its usage:
numbers = [1, 3, 5, 7, 9, 11]
for number in numbers:
if number % 2 == 0:
print(f"Found an even number: {number}")
break
print(f"{number} is odd.")
else:
print("All numbers are odd. How odd.")
Try running this example but with an even number in the list, see how the output changes as you do so.
!release 3.6
No Category:
help Shows this message
Type !help command for more info on a command.
You can also type !help category for more info on a category.
!e
data = ["hello", "hi", "bbbbbbbbb", "z"]
data = sorted(data, key=len)
print(data)
@icy raven :white_check_mark: Your eval job has completed with return code 0.
['z', 'hi', 'hello', 'bbbbbbbbb']
@leaden drift
tableData = [['apples', 'oranges', 'cherries', 'banana'], # len 4
['Alice', 'Bob', 'Carol', 'David'], # len 4
['dogs', 'cats', 'moose', 'goose']] # len 4
so printing in the same order (i.e. order didn't change)
are you guys able to hear me ?
Write a method that, efficiently with respect to time used, finds the n-th lowest selling book in the list. Each element of the sales list represents a single sale of a book with that book's id. The n-th lowest selling book is the book that has more sales than n-1 books. Assume that book sales counts are unique. For example, nth_lowest selling([5, 4, 3, 2, 1, 5, 4, 3, 2, 5, 4, 3, 5, 4, 5], 2) should return 2. In the list, the book with the id 1 was sold once, id 2 twice, id 3 three times, id 4 four times, and id 5 five times, making the book with the id 1 the lowest selling book in the array and id 2 the second-lowest selling book.
def nth_lowest_selling(sales, n):
"""
:param elements: (list) List of book sales.
:param n: (int) The n-th lowest selling element the function should return.
:returns: (int) The n-th lowest selling book id in the book sales list.
"""
return None
if name == "main":
print(nth_lowest_selling([5, 4, 3, 2, 1, 5, 4, 3, 2, 5, 4, 3, 5, 4, 5], 2))
!e
code
def main():
print("Introducing magic Six!")
def magicSix(a,b):
a = 0
b = 0
magicSix = 6
a = int(input("What is your input for A? "))
b = int(input("What is your input for b? "))
if a or b or (a + b) or (a - b) != 6
return('Not a Magic 6')
elif a or b == 6
return ("Magic 6!")
else:
if (a + b) == 6 or (a - b) == 6:
return("Magic 6!")
print("magicSix", a,b))
main()
what is syntax error for if a or b or (a + b) or (a - b) != 6
not sure how to fix
#p snoop dog
you guys gotta try this script
https://github.com/asweigart/zombiedice/ For the code dice
I'm alright. Nursing a headache, but beyond that not bad
https://automatetheboringstuff.com/2e/chapter6/ For the current chapter we're on
It's right down near the bottom
Thanks. I can never remember how to do that.
We're making automated bots for games? I hear there's one for TF2.
Makes the game unplayable though
you can get away with getting the id or class for the tag you want to go to
TIL
and tomorrow you use!
Ooo, I like that follow up to that.
fix the string
BRB getting a burrito
This conversation is brought to you by Nord VPN

wait when did we get gopnik hemlock?!?
-sighs- Still amazed someone made and added that
we need this
@buoyant kestrel we still don't have linux penguin in pydis
[this is a public service announcement]
Submit ideas and stuff to #dev-branding
auto correct
which hemlock is typing
conda install -c conda-forge zombiedice
What's Magical Girl doing?
What's @fresh sail doing? I can't recognize it.
zombiedice
Yes
It looks like Python
Thanks 🙂
do ctrl + on vscode
ctrl + what?
Wow, speed running Python.
CTRL + +
?
Alt + F4
C++?
haha
I understand what the C means now
⊞ + L
what kind of error?
A very intriguing conversation.
Look to the left-hand side margin.
Everyone is Mr.Hemlock.
Hi I'm Hemlock look at me!!
I'm Mr. Meeseeks, look at me!
.wav download: https://drive.google.com/open?id=1TqoLOhtf5iaggeVIdAidxecjhe2S55OY

