#voice-chat-text-0
1 messages Β· Page 773 of 1
looks very slick!
so essentially you have given with a number and you have to find out the two prime number whose addition is same as that number
we have to represent with exactly 2 prime numbers?
yes exactly 2
ok got it
so for every first number we have to represent it with sum of two prime number
like for 24, 6, so on.
yes
Is there any time limit for these question
like does the time complexity of the algo matters?
additionally the first number of the sum has to be equal or bigger than the next
If yes, then the best algo is to use sieve of eratostheses
to find all the prime numbers
well i have the code to find prime numbers
i just dont have any idea how to do the second part
but thanks for your time and help
# Generate all prime numbers less than n.
def SieveOfEratosthenes(n, isPrime):
# Initialize all entries of boolean
# array as True. A value in isPrime[i]
# will finally be False if i is Not a
# prime, else True bool isPrime[n+1]
isPrime[0] = isPrime[1] = False
for i in range(2, n+1):
isPrime[i] = True
p = 2
while(p*p <= n):
# If isPrime[p] is not changed,
# then it is a prime
if (isPrime[p] == True):
# Update all multiples of p
i = p*p
while(i <= n):
isPrime[i] = False
i += p
p += 1
# Prints a prime pair with given sum
def findPrimePair(n):
# Generating primes using Sieve
isPrime = [0] * (n+1)
SieveOfEratosthenes(n, isPrime)
# Traversing all numbers to find
# first pair
for i in range(0, n):
if (isPrime[i] and isPrime[n - i]):
print(i,(n - i))
return
# Driven program
n = 74
findPrimePair(n)
# This code is contributed by
# Smitha Dinesh Semwal
for this the ans is 71 3
and that's the code
impure functions π€’
def isPrime(i):
x = 0
for o in range(2, 100):
if i % o == 0 and i > 0:
x += 1
if x == 1:
return True
prime = [y for y in range(1, 100, 2) if isPrime(y) == True]
here is my code for prime
it doesnt use this guy Eratosthenes
yaa that's the simple way to find the prime numbers
but it's slow
when you run this function for every number
in your range
!src
it does not have to be fast
I think there's a text file you can download from Wikipedia, which has the all the prime numbers found till date
just use it
I believe that'll be the fastest way ever
for numbers under 10000, doesn't matter
yes there is
but i wanted to code it
to try myself
yaa
it took me almost a day
whoa that's too long
if you can't solve a DSA question in 30 min or so
just stop, do it some time later
but stop for sure
not the code part, I mean the logic part
what does DSA mean?
Data Structures and Algorithms
thanks for a advice
best advice I can give is
if you're doing a DSA question
always first do it on paper ( logic + pseudo-code )
then on the pc
don't need to write the actual code on paper
just the logic part
only experienced coders should do that
ehhhh
As long as you are able to find the logic part quickly then it's good
its like, your first day in the Gym, and you're already lifting the heaviest weight
bad practice
I mean there's nothing wrong with trying to think of how you want to do it
Right but that's not the same thing, Acc
This is the mental prep
well, yeah, but put those thoughts on paper first, rather than on computer
wait I have the best thing for showing it
βοΈ π π
or have a habit of making your code as extensible as possible
I tried Pytest once
Ah same with me. Thanks for the response tho
but should learn UnitTests, other langs don't have Pytest
Can someone help me with my code I cant talk
1- What are trying to do?
2- what did you implement?
3- What the error message?
4- let's hop on help channel π
Evenin'
does anyone knows FileMode part for this command?
It's looking like there's an input() somewhere and it didn't have a place to get that input from
I googled bedrock
In fairness, that also looks blocky
gotta go, work stuff. maybe i'll be back in a few, no clue
the code look like this ```
from math import sqrt
formula = input("wich side do you want to calculate(a, b, c)?")
if formula == "c":
a = int(input("a side length: "))
b = int(input("b side length: "))
c = sqrt(a * a + b * b)
print("c side length is ")
print(c)
elif formula == "a":
b = int(input("b side length: "))
c = int(input("c side length: "))
a = sqrt((c*c) - (b * b))
print("a side length is")
print(a)
elif formula == "b":
a = int(input("a side length: "))
c = int(input("c side length: "))
b = sqrt((c*c) - (a*a))
print("b side length is ")
print(b)
else:
print("Please write the right side (a, b, c)")
I know but I need the input tho and how can it go there
What are you trying to do? Like what triggered the error window
I want ask question about debug Spyder
How to set up condition breakpoint
I don't know enough about Spyder to be able to help. You might ask over in #editors-ides
They might be able to help
Ok, thanks a lot
Just got a mail
We have planned for leader speaks session with XXX XXXXXXX(Program Head) on 10th March β Wednesday from 03.15PM to 04.45PM. Please go through the below Kpoint video to understand about the Leaderβs journey and key messages before Monday (8th March) EOD so that we can have maximum duration for the Q&A session during the connect. Thanks.
wtf is all these session's they make us attend π©
Yeah that one feels a bit odd
I hid the Name with XXX
they said not to reveal anything anywhere, or there will be "consequences"
I wanted to ask rabbit the Intune Portal Stuff
but I thought I might reveal something by mistake
so how does this Java works?
i go to this link https://www.java.com/en/
download and install it
and I have it in my CLI?
if I remember correctly (I have used java once) Java has 2 main components, the JDK (Development Kit) and the JRE (Runtime Environment), with the JRE installed you can run .jar files with java file.jar where as you can compile things with the JDK (I've never done it before)
OpenJDK has clearer installation instructions
lol
@wise glade Sorry, we quickly did the test then I had everyone move back
That's my bad
I just needed to see if I could join a full VC only by dragging myself
It was a sanity check
Rust is FP, but the good parts
I read the description on the site, I don't understand what it is?
is it SDK + runtime + something_more?
It's open-source as well
so If I install it, I'll have Java on my pc?
Sure
in my CLI?
HotSpot should be fine
async def Classic_Duels(self, ctx, *, arg):
uuid = requests.get('https://api.mojang.com/users/profiles/minecraft/' + arg + '?')
Now that I think about it Mono is kinda like OpenJDK
We could add that I suppose
I feel like I should do more C# at this point
so for writing a hello world program
create a file with .java extension
write the code
in CLI type java file.java
is that all?
not like dotnet new console stuff right?
No
They may look similar at code level but they are completely different on development and operation level
Mono isnβt really a thing anymore
Like itβs floating around but with core being cross platform, itβs sucked a lot air out of Mono
just one question, then I'm gone
package helloworld;
public class HelloWorld{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
``` what does very first line do?
I absolutely love it that no one is able to answer this one
f***ing java
bye guys π , have a nice day
Cool, halfway done with my college application π
Hey
@ laundmo what are ya workin' on?
I'm new can I get a job with basic machine learning skills?
how basic
hey
bazinga
what are u talking about?
I wrote this to fetch xkcd comic images for screensavers ;)
https://gist.github.com/ravish0007/be8f6a68128c00ad823005d77c555772
Oh, thank you very much.
@whole bear sometimes, I don't finish the projects and move on to another project.
@whole bear i understand. For me its like a habit. if you get in the habbit of finishing no matter what when you start things bro. I dont sleep when I have something sitting unfinished
im in the middle of that kind of thing right now, cant sleep cause I am at the tail end of a 10month project
That is a good mindset to have
People who want to be successful in whatever they want do have that mindset which is great.
def find_function_in_ast(fn_name, src):
"""Finds line number of start and end of a function with a
given name within the given source code.
"""
tree = ast.parse(src)
for parent in ast.walk(tree):
fn_end = len(src.split("\n"))
for child in reversed(list(ast.iter_child_nodes(parent))):
if (
not isinstance(child, ast.FunctionDef)
or child.name != fn_name
or not hasattr(child, "decorator_list")
or len(
[
dec
for dec in child.decorator_list
if ast_get_decorator_name(dec) == "reloading"
]
)
< 1
):
if hasattr(child, "lineno"):
fn_end = child.lineno - 1
continue
fn_start = min([d.lineno for d in child.decorator_list])
return fn_start, fn_end, child.col_offset
return -1, -1, 0
Nope
sirius
polaris
Can someone hop in code help 0?
!voice @icy hare That should tell you what you need to know
Voice verification
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@meager crow https://www.keybr.com/
hemlock, need some help π
howdy π
I am trying to plot two dataframes on one chart, I will send the dataset format, I have managed to get
what ??
start = dt.date(2020,5,5)
end = dt.date.today()
values = data.DataReader('FB', 'yahoo', start, end)
values1 = data.DataReader('AAPL', 'yahoo', start, end)
# values1.columns.values[3] = 'aapl_close'
print(type(values))
# joined = pd.concat([values.assign(dataset='values') ,values1.assign(dataset='values1')], axis=1)
ax1 = plt.subplot(figure(figsize=(10,6)))
plt.margins(x=0)
print(pd.concat(values['Close'],values1['aapl_close']))
# print(values1)
# value1 = pd.DataFrame(values[['close',values.index]])
# value2 = pd.DataFrame(values1[['close',values1.index]])
# sb.lineplot(y=[values['Close'],values1['aapl_close']], x = values.index)
ax2 = sb.lineplot(y='Close',x=values.index, data=joined, style='dataset')
ax2 = ax1.twinx()
plt.show()
# print(joined)
# print(type(joined))```
the chart above is returned if I concate, on axis 0
??
anything you would have to say on this, would be good
from matplotlib import figure
import pandas_datareader.data as data
import pandas as pd
import datetime as dt
import matplotlib.pyplot as plt
import seaborn as sb```
no worries
my system crashed π¦
idk
all the sudden my mac just shut down and then it rebooted
i was playing a game so maybe that caused the system crash
can anyone help me run a programme in c++
can u screenshare and show how does it work
i just want to know how u save and then go to the prompt and run it
it says i need an app for that lol
ok thx guys
@terse needle r u studying cs?
yep
yes, well to the degree I can in secondary school
is there a channel for c++?
woops
@terse needle what do u mean?
I don't think so
i posted the wrong link
can anyone help me in phosphorus chat
There are c++ discord servers that could give you better answers
can u link one
I'll dm you one
nvm
i've had the best help on Together C & C++ over Better C++
why python tho, my teacher said its really slow
@hoary inlet Didn't know if you saw this. From what I can tell, you should be using subplots() rather than the singular one
give me a min
No worries, sorry
why r u sending pictures?Γ§
?????
One sec, talking to co-worker
okay, so the link mainly talks about, diving the main chart in small blocks, I want two lines on the same chart. Something like this
Actually, you know what..... @whole rover Do you have experience with matplotlib? If so, I could use your knowledge
I only ask you specifically because you are the God of Graphs
then they will have a life, which they can't handle
I mean other than Joe, I'd just be able to point you to #data-science-and-ml
I never really messed with graphs and what not
background tabs
I have this weird issue on my chrome, It opens a website every 24 hours, anyone knows why ?
which one?
@solar scaffold when you have that compiler installed run g++ file.cpp -o main
assuming you installed g++
I don't feel like coding
you added it to path ?
my question is, I wanna start with
But I want to to get a job
int main() {...
how do i like press enter to go to the second line without running it
press enter
if I do it it runs it
what editor are you using
cygwin
what, like you are running the code in cmd
how do i like press enter to go to the second line without running it
down arrow?
@uncut meteor are you looking for the ksp server haha
won't it be better to add it to path and then connect it to a text editor
yeah sure ill try that
KerbalSpaceProgram preferably. Not what ever popped up

yeah
i think so
I also didn't know dm's trigger the bot
so big Rip
I am so tired, I wasn't even listening what was going on and suddenly I am like wtf
1'o clock night
π’
meh, I can't until I figure this one out, last night I didn't know about json and finally it worked out
it's kind of like punishment and reward
:)
what you guys were streaming the landing ?
nope, only hemlock
Ah no, I was thinkinh about don't starve
website or webset ?
web app
What's the difference between sorted and sort
apis return json format no ?
Why am I not able to save list.sort() but able to store sorted(list)
So list.sort() sorts it "in place", meaning it doesn't return anything when it does it. It just sorts the object then and there
you are trying to change the value ?
sorted(list) will return a list because that's just how it do
okay converts a series of tuples into lists ?
hi
async with aiohttp.ClientSession() as session:
async with session.get(
'https://api.hypixel.net/player?key=d667c1b3-377e-4c6f-8177-58af52a110ca&uuid=' + uuid) as response2:
print('Connected To API')
apiInfo = await response2.json()
name = apiInfo['player']['displayname']
kills = apiInfo['player']['stats']['Duels']['classic_duel_kills']['value']
deaths = apiInfo['player']['stats']['Duels']['classic_duel_deaths']['value']
Ignoring exception in command classic_duels:
Traceback (most recent call last):
File "D:\Hypixel Stats Bot\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "D:\Hypixel Stats Bot\main.py", line 45, in classic_duels
kills = apiInfo['player']['stats']['Duels']['classic_duel_kills']['value']
TypeError: 'int' object is not subscriptable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\Hypixel Stats Bot\venv\lib\site-packages\discord\ext\commands\bot.py", line 902, in invoke
await ctx.command.invoke(ctx)
File "D:\Hypixel Stats Bot\venv\lib\site-packages\discord\ext\commands\core.py", line 864, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "D:\Hypixel Stats Bot\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'int' object is not subscriptable
Process finished with exit code -1
what IDE do yall use?
what can you store inside a tuple ?, string, int or dict, lists as well
so on using the flatten if there are lists inside the tuple
it will make a lists of lists ?
or will it flatten out all the lists inside it as well
That's a really good question. I guess it depends on the implementation
Okay so
Python doesn't have a built in flatten. So it entirely depends on how you implement it or how another library you use does it
!e
!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!*
what's this for? discord bot ?
when i get error in code https://cdn.discordapp.com/attachments/720213272543887450/817114825637363712/rage.mov
true
community
When do you know you've learnt
I feel like I know everything
what's the most advanced topic you think you know ?
Oh well I know the basics
you know the syntax ?
the more you know the more you realize how less you know
enlighten us ?
no
its more complicated
I mean I know the basics I want to get started with building something
build a house
why'd you learn Python in the first place?
anyone here used the pandas plotting ?
which field of computers do u want to go into specifically?
as a..?
you like web design or back end stuff
web dev? app dev? or sth else
?
I mean I match statistics number
if u like the process of programming try algorithm engineering
If it is coming correct
@uncut meteor ever used pandas plotting ?
nah
Omg you're hearing voices
how are you sure the voice was not in the chanel ?
@bot.group()
async def stats(ctx):
await ctx.send('**Command Format: **/stats `Game` `GameType(For Games With Multiple Modes)` `User`')
cos i deafend
What does this do
discord bot
@bot.group()
async def git(ctx):
if ctx.invoked_subcommand is None:
await ctx.send('Invalid git command passed...')
@git.command()
async def push(ctx, remote: str, branch: str):
await ctx.send('Pushing to {} {}'.format(remote, branch))
discord is the way to go
@rugged root Got this, using the pandas plotting. how do I get rid of the margins ?
plt.margins(x=0)```
this command works but I am calling the plot on dataframe itself @faint ermine
what ?
what purpose do these serve ?
no clue
I can see a couple of uses for this
@stats.group()
async def BedWars(ctx, )
async def SkyWars(ctx, )
async def MurderMystery(ctx, )
async def ArcadeGames(ctx, )
async def UHCChampions(ctx, )
async def ArenaBrawl(ctx, )
async def BuildBattle(ctx, )
async def CopsAndCrims(ctx, )
async def Duels(ctx, )
async def MegaWalls(ctx, )
async def PaintballWarfare(ctx, )
async def Quakecraft(ctx, )
async def BlitzSG(ctx, )
async def SmashHeroes(ctx, )
async def SpeedUHC(ctx, )
async def TheTNTGames(ctx, )
async def TurboKartRacers(ctx, )
async def VampireZ(ctx, )
async def TheWalls(ctx)
async def Warlords(ctx)
you working on minecraft?
Is that donut chart
"Which country are my Discord users from?" "fuck if I know"
What is webhook
is it something related to APIs?
imagine fishing... but in the cloud
Imagine being Spiderman and also a Pirate
so, he was right
by @tiny socket : webserver waiting waiting for request
POST https://discord.com/api/v8/webhooks/{webhook.id}/{webhook.token}
Source Google : A Webhook is basically a way to be notified when an event has occurred, usually not due to a direct action from your application
to be honest i am learning new thing thanks
like something triggers it and it sends out an alert
Doubt : API vs Webhook
Correct, but not due to your actions, Luna
I suggest to call it
You're just watching for it
yeah, like it is monitoring and if and when it gets triggered, it alerts
I deserved this
@faint ermine ok it make sense
I lost in between
do API have any fullform or it doesnt stand for anything?
you intentionally trigger an api, while webhook triggers itself on some already given condition and carries out any action it was instructed for
Webhook are pump and dump
winner
APIs are generally more transactions
ohk
doesn't really trigger itself, it has to be triggerd by something*
ok now this statement make sense
webhook will do something when the order is delivered
@rugged root i was learning Django and as now we heated the discussion of websites servers and APIs, I just wanted to ask do you need to pay for your website host name and a web server to host your website or is their another way because sites made from Wordpress are free and dont require payment.
Well okay, so
you have to explain the pump and dump word, I just think about stock pump and dump schemes
If you're going to set one up yourself or have a service run it, you will. And you will typically still need to register a domain name
But those can be cheap cheap cheap
Can we create WhatsApp bot
And is it payonce or you need to renew it time to time
Just joined. What's this about pumping and dumping? π
got it
makes sense
Webhook vs API requests
is it like that?
Why you guys make report?
who do you submit it to?
Discord Trust and Security so it can be ignored
ohk
I know "sometimes they do"
but in GENERAL, it seems like a blackhole and it doesn't matter since Discord is open to anyone
lmao
my biggest complaint is Discord doesn't let us control who can message us
like if you don't have a verified phone number, I don't want to speak to you
I got your point
Could always send it in as a request. More voices who ask for it, more likely it'll happen
I don't know, I don't want to add my number on discord. It's already too much interlinked
I mean if you friend someone I don't think you'd have to restrict it
@faint ermine do you pay extra to your isp for port forwarding?
Hey, how goes?
:
going
wanna see me do the russian + idnian accent
Yea, If you friend someone, it would bypass all the features but I'd like to be able to turn on "Accept PMs from server members" in big servers
Word
yes please
without dealing with drive by trolls
ok
nope
I don't trust you
he is trying to mimic putin, how much more weird do you need ?
no problem
i watch bees have sex at 2 A.M.
you wanna hear more?
πΆ
noMADπ€£
how many holes does a straw have?
want to hear a joke
i was up till 3 a.m watching Hornet king videos
dude, you really are starting to weird me out
2
define hole
We gonna need to go to the polls
shirt got 2 holes
seconded
topologically
do you want to hear a joke?
i watch vsauce lmao
I wonder if anyone can resolve my laptop issue
It is incredibly slow. It freezes
And hangs
:(
What timezone is space?
@tiny socket S A V A G E
hemlock's not that bad, he churns out a couple of good ones in a while
Quality by quantity
Do you want to hear a joke?
Ask Astronaunots
yeah, why can't poor people be rich ?
@oblique compass What timezone is space?
Apparently a t-shirt has 3 holes π
lmao
According to mathematicians.
what region is voice server in?
good one
good one?
eu-central
I wish to talk
you just did
@olive dawn is in server
why are we interested in this again ?
do you want to hear a joke?
Rabbit asked, I answered
please man
Why you pinging bee?
i like bees
I really want to tell a joke
tell it
yes
i have a good one too
it will
If you cook two lasagnes, then put one on top of the other.
How many lasagnes do you have?
I was wondering if I should stop learning programming
For every second on Millers Planet a day passes in Africa
Two men walk into a bar
Because it's too tough for my little brain
That was a jokoe
the third one ducks
how fast do you change your mind ?
Love that joke, G
π
One of my all time favorites
really no one got it
I don't get it
I need an answer for this.

yah they are in raps
I like to think so
it can either be a pub or a metal poll
2 men walk into a metal poll
the second one duck under it
kill me
how to spell lasgnaya?
Lazeragne
π
My laptop is so slow I can't program
Back in a bit...
try and pronounce this : "Worcestershire Sauce"
Worcestershire
Joke : what do you call a person with no body and nose
Answer : No body nose
I ordered Egg and chicken on Amazon
but the Egg was on Prime
so you know what got first
lawnsanya
Lasagna
lawnzonyuh
wait let me just pewdiepie it
okay, so what is the difference b/w creating just a python file in vscode or when you create a project in ides ?
Worcestershire Sauce
Bitch lasagna pewdiepie helped
I have problem with sh
I had never heard of the word before
what? you dont know about words?
ohk i thin its racist
understandabel
I don't think he knew about the western conotations of the word
i am so kid i dont even know spelling of appolozize
yeah, hemlock we get it you are an admin, Management/corporate jxxxoffs
π
the question is are you at least 13
ohk i am 17
idrk I dont think 17 is really much of a kid
See you later
I hope I didn't sound like that
lmao ded
KringΓ©
yep, I understand now
well there are indians as CEO of Microsoft and Google and there are Indians like me
so nation doesnt matter
as long as you know
But they do good imitation
THANK YOU discord; i almost did a dum dum
I can't do their accent
can I interest you into alt-f4
Gotta go.
what happens if i just beat my laptop with hammer? will it fix the popups?
yep
or better yet, click the links. The popups will disappear and you will get to another website!
chili, you have any knowledge of matplotlib ?
@meager crow any speed runner can be bodied by AI, whats the point
What ia matplotlib used for
I think for making graphs
why ?
it took me to some fluid site
and they are selling honey
should i buy?
What does fluid represent here
what ?
what is there to solve ?
watch code bullet video he solve 1000 X 1000
2min tops
what is a roobiks cube
Lifetime
you just got to remember the steps
kid cudi?
@meager crow that was so slow
yes I'm not that good
yes
spoken like a programmer
I am not able to solve Rubik's cube .
@uncut meteor there is a program on github
:(
9*2^3
@uncut meteor make that a problem on codewars
Hehe
vector of vectors ??
Breaking World Records and destroying a massive 100 x 100 Rubik's cube
Check out my previous video explaining how I made the AI: https://www.youtube.com/watch?v=f9smvQ5fc7Q&t=69s
Also the Source Code is now up on my Github: https://github.com/Code-Bullet/RubiksCubeAI
Twitter: https://twitter.com/code_bullet
Patreon: https://www.patreon.com/...
It's cuboid
Is theee online gane
@meager crow are there mathematical functions defining rubics cube
rubiks*
I mean there are algos to solving it so
because i studied set theory and there was a paper on solving rubiks cube
the issue is how to connect all the sides and how each side interacts with each other on any movement
everything can be relative to the centre piece
Every node has a graph of states and changes
Updated Video
Nearly 2 million views on the original video!
The biggest rubik's cube... ever, being solved by a computer.
Check this out! https://soundcloud.com/kingpin_productions/lorde-royals-king-babylon
until yesterday I would have hated you for this statement
ah yes jason
NO BEST LANGUAGE IS XML
**2 β’οΈ
Html is so hard
that's better than me who can't even python. I only joined cause I wanna learn
Variable in html?
it was SARCASM
you really fxxxxd up your mic ?
well wanna talk about AI movies?
anyone played Deteroit become human?
let me try alt + f4
!d3f Detroit
Pep8
Mm
heyy lads
got awfully quiet in here π
yeah
where ?
@fallen sphinx
lastName = input ('Your last name?')
birthDate = input ('And the date of birth?')
idenityInformation = open("c:\\python\\Indenity Text.rtf", "r+")
idenityInformation.write(firstName + lastName + birthDate)
idenityInformation.close
idenityFile = idenityInformation.read()
print (idenityFile) phy ```
def solution(string,markers):
split_string = string.split('\n')
print(split_string)
newString = []
for i in split_string:
inComment = False
trip = False
for x in i:
if x in markers:
trip = True
break
if not trip:
newString.append(i.rstrip())
if trip:
for z, x in enumerate(i):
if x in markers:
newString.append(i[:z].rstrip())
break
if z >= len(i) and x not in markers:
newString.append(i.rstrip())
break
return r'\n'.join(newString).replace('\\n', '\n')
for me ?
well for kj but you can do it too
I just signed up am going through the first challenge
@zealous wave have you done that kata? the one you just linked?
that was good
store[0] = occurances[i]
store[1] = occurances[i+1]
occurances[i] = store[1]
occurances[i+1] = store[0]
https://binarysearch.com/room/How-do-I-Java-TB9Ae9RnWn @uncut meteor @zealous wave @terse needle
π₯Ί
π
me irl
.pyfact
If you type import this in the Python REPL, you'll get a poem about the philosophies about Python. (check it out by doing !zen in #bot-commands)
Suggest more facts here!
.pyfact
If you type import antigravity in the Python REPL, you'll be directed to an xkcd comic about how easy Python is.
Suggest more facts here!
.pyfact
Python was named after Monty Python, a British Comedy Troupe, which Guido van Rossum likes.
Suggest more facts here!
.pyfact
If you type import this in the Python REPL, you'll get a poem about the philosophies about Python. (check it out by doing !zen in #bot-commands)
Suggest more facts here!
π
Interested
Learn algorithms together on binarysearch. Create a room, invite your friends, and race to finish the problem.
Whachu doing?
So is this like a competitive thing? π
i guess lol
Nice, it does!
might just write it in nvim and yank it over ;-;
Exactly π
Didn't realise you were looking at my code π
π
Oh, next accepts a default value...
Yep @uncut meteor
!e
print(next(iter(range(3, 0)), 10))
@honest pier :white_check_mark: Your eval job has completed with return code 0.
10
!
GG
Yeah, I will
Jake's having dinner
Sorry?
Tripped me up at first too Griff π
Same, didn't read the question carefully.
sum(int(x) for x in s if x.isdigit()) π
Oh, nice solution @honest pier π
My solution seems kind of complicated compared with using regex 
Itertools is probably my most used module.
Erm, it splits an iterable into chunks (groups) based on some function.
!docs itertools.groupby
itertools.groupby(iterable, key=None)```
Make an iterator that returns consecutive keys and groups from the *iterable*. The *key* is a function computing a key value for each element. If not specified or is `None`, *key* defaults to an identity function and returns the element unchanged. Generally, the iterable needs to already be sorted on the same key function.
The operation of [`groupby()`](#itertools.groupby "itertools.groupby") is similar to the `uniq` filter in Unix. It generates a break or new group every time the value of the key function changes (which is why it is usually necessary to have sorted the data using the same key function). That behavior differs from SQLβs GROUP BY which aggregates common elements regardless of their input order.... [read more](https://docs.python.org/3/library/itertools.html#itertools.groupby)
Got it wrong, sorry π
!eval ```py
from itertools import groupby
for key, group in groupby('123abc456def', str.isdigit):
print(key, ''.join(group))
@stuck furnace :white_check_mark: Your eval job has completed with return code 0.
001 | True 123
002 | False abc
003 | True 456
004 | False def
!e
from itertools import groupby
def check(x):
try:
return int(x) > 5
except ValueError:
return False
for key, group in groupby('123abc456def789ghi', check):
print(key, ''.join(group))
@uncut meteor :white_check_mark: Your eval job has completed with return code 0.
001 | False 123abc45
002 | True 6
003 | False def
004 | True 789
005 | False ghi
Yeah, it's a nice one.
That will work. Remember to deal with the last group.
Bring it Griff 

I think Pasta changed his π
lul
Yeah, so say you start with 1234
1 + 2 + 3 + 4 = 10
1 + 0 = 1
Probably not a good example π
1 < 10 so that's the answer.
Another example?
air
?
5678
5 + 6 + 7 + 8 = 26
2 + 6 = 8
Pretty bad π
You're also likely to end up with a maximum recursion error.
Yes, e.g. in Lisp. Not sure if C or C++ implements this optimisation.
Tail call optimisation is kind of interesting, because it makes iteration a special case of recursion.
im just gonna go, im just embarrassing myself and im shit at this
Jake are you Slushs?
ye
I couldn't tell the difference
Was confused why you were muted π
I heard a new programming term today...
klapby
load-bearing function - a function that can't be removed without making structural changes to the rest of your code
1614892524560
Unix/Epoch
that's a good one π
π the real mina
!docs time.gmtime
time.gmtime([secs])```
Convert a time expressed in seconds since the epoch to a [`struct_time`](#time.struct_time "time.struct_time") in UTC in which the dst flag is always zero. If *secs* is not provided or [`None`](constants.html#None "None"), the current time as returned by [`time()`](#time.time "time.time") is used. Fractions of a second are ignored. See above for a description of the [`struct_time`](#time.struct_time "time.struct_time") object. See [`calendar.timegm()`](calendar.html#calendar.timegm "calendar.timegm") for the inverse of this function.
!docs time.localtime
time.localtime([secs])```
Like [`gmtime()`](#time.gmtime "time.gmtime") but converts to local time. If *secs* is not provided or [`None`](constants.html#None "None"), the current time as returned by [`time()`](#time.time "time.time") is used. The dst flag is set to `1` when DST applies to the given time.
wtf lx
!docs operator.itemgetter
operator.itemgetter(item)``````py
operator.itemgetter(*items)```
Return a callable object that fetches *item* from its operand using the operandβs [`__getitem__()`](#operator.__getitem__ "operator.__getitem__") method. If multiple items are specified, returns a tuple of lookup values. For example:
β’ After `f = itemgetter(2)`, the call `f(r)` returns `r[2]`.
β’ After `g = itemgetter(2, 5, 3)`, the call `g(r)` returns `(r[2], r[5], r[3])`.
Equivalent to:
```py
def itemgetter(*items):
if len(items) == 1:
item = items[0]
def g(obj):
return obj[item]
else:
def g(obj):
return tuple(obj[item] for item in items)
return g
``` The items can be any type accepted by the operandβs [`__getitem__()`](#operator.__getitem__ "operator.__getitem__") method. Dictionaries accept any hashable value. Lists, tuples, and strings accept an index or a slice:... [read more](https://docs.python.org/3/library/operator.html#operator.itemgetter)
You can also do the zip(*...) trick π
Just remembered.
!eval ```py
print(list(zip(*[[1, 2], [3, 4]])))
@stuck furnace :white_check_mark: Your eval job has completed with return code 0.
[(1, 3), (2, 4)]
It basically transposes the rows and columns.
π
!eval Maybe a clearer example```py
print(list(zip(*[[1, 2], [3, 4], [5, 6], [7, 8]])))
@stuck furnace :white_check_mark: Your eval job has completed with return code 0.
[(1, 3, 5, 7), (2, 4, 6, 8)]
Yep π
Well, doing zip(*[[1, 2], [3, 4], [5, 6], [7, 8]]) is like doing: ```py
zip([1, 2], [3, 4], [5, 6], [7, 8])
Cya @honest pier π
My attempt at illustrating the problem: ```
interval 1: |----|
interval 2: |---------|
interval 3: |-----|
solution: |--|
Alright π
Nah sorry
I just spend too much time doing programming puzzles...
op op
I'm rubbish at almost anything practical.
gg
!eval ```py
def line(start, end):
return ' ' * (start - 1) + '|' + '-' * (end - start - 1) + '|'
intervals = [
[1, 100],
[10, 50],
[15, 65]
]
for start, end in intervals:
print(line(start, end))
solution = [15, 50]
print(line(*solution))
@stuck furnace :white_check_mark: Your eval job has completed with return code 0.
001 | |--------------------------------------------------------------------------------------------------|
002 | |---------------------------------------|
003 | |-------------------------------------------------|
004 | |----------------------------------|
I got frustrated counting -s 

Cya Griff π
@terse needle you still want to play?
Can we kick Griff?
Ah, I once knew the formula for this...
You might enjoy my solution to this one π
Had to work it out with pen and paper.
Alright see you!
I'm not sure if there's an intuitive explanation for why it's the case.
Anyway, I'm going to head off too. Bye π
if anyone wants to talk about python stuff im in the vc from now until 9:25 est
Voice verification
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
!voiceverified
You are not allowed to use that command.
ighttt
!voiceverify
i found it says i need to say 50 messages
i seeee
i think i joined like a week ago
i see
if thats the case i m gonna do something else i was trying to fix some code
but iz all goodies
i would but i need to take a break
ive been debugging for two hours
SOOOO HAVE A NICE DAY SIR
!projects
Kindling Projects
The Kindling projects page on Ned Batchelder's website contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
.pyfact
Python was named after Monty Python, a British Comedy Troupe, which Guido van Rossum likes.
Suggest more facts here!
I guess not
You guess incorrectly.
@somber heath Can you help me with exec() and lists?
I'm in voice.
so
I have a programm
and that works with many lists
and in a specific case
I have to use an exec('list = [value1, value2, value3]')
to set a list
the list is a global
and i am running the exec('list = [value1, value2, value3]') inside a function
I already did global list before
so
I'm using exec
because
i didn't do so
yes
list()
i know this one
but
im writing a discord bot
and the user should be able to use a command inside discord and then let it be executed in python
thats why I'm using exec
the problem is
for example
im typing...
list1 = [1, 5, 3, 7, 'bl', True, 'some text']
string = '[3, 2, 'tex', True, False]'
exec('list1 = 'string)
but list1 is still [1, 5, 3, 7, 'bl', True, 'some text']
there isn't any error returned
but
the thing is
when I do the same thing with a variable instead, it's working
i also tried using f string, but I think it's pretty much the same
Letting Discord users use exec π
Yeah, I've not looked too deeply into it.
But I think they use some kind of sandbox?
It's a jailed container
@cursive minnow exec('list1 = string') vs exec('list1 = 'string)
but Opal, when I say
exec('list1 = 'string)
, i think it's the same thing as
exec('list1 = [3, 2, 'tex', True, False]')
I think
if string is [3, 2, 'tex', True, False]
Yes, you need to escape the 's
so, i should use """ instead of ' ?
That would work!
ok, thanks
Although, isn't py exec("x = 1") functionally equivalent to ```py
x = 1
I think so
Yeah, Hemlock, I don't recommend DIY brain surgery π
Do you get visual disturbances with your migrains?
Oh weird. I get headaches from temperature changes.
And sleeping too long 
will this run
based i=on sandboxing and subprocess
!e ```import subprocess
n = 0
def fork():
global n
if n > 10:
return ""
else:
print(subprocess.run(["ls", "-l", "/dev/null"], capture_output=True))
n += 1
fork()
fork()
which interpreter is used on the server
I just remember the few basic regex symbols.
+*?{}[]|() are basically all you need 99% of the time.
Having audio troubles, Gi?
Erm, has anyone here installed ffmpeg on MacOS? Is it supposed to have this many dependencies? π
π
I'm kind of paranoid about installing software...
Erm, I'm just paranoid in general π
Probably a side effect of basically not leaving the house for a year 
Back in a bit...
Btw, we're on Sydney again π
Yeah but it's not that bad
Seems fine actually.
All the name changing gets me so confused π₯΄
Yeah, that helps.
pisses me off, you think you know the guy and he changes his identity
Imagine that happens in real life π
Yep
I had this professor at uni who was incapable of recognising faces.
I imagine that's what life is like for her.
He's too distinctive for my taste.
I feel the same way about Leonardo DiCaprio.
Oh right, I'll put that on my to-watch list π
Gary Oldman is like the opposite
Totally disappears into his roles.
Yo Rabbit
Harry Styles?
Was in Dunkirk.
Ah he died recently
Yeah, from cancer
today's last day of the week on job Hemlock?
today's last day of the week on switch Rabbit?
@wise glade ping
does Docker container and Kubernetes does same thing?



