#off-topic-lounge-text
1 messages ยท Page 37 of 1
with open('a', 'w') as a, open('b', 'w') as b:
do_something()
@void torrent https://pythonbasics.org/what-is-flask-python/
but also checkout Django
ok
Lib/shutil.py line 406
def copy(src, dst, *, follow_symlinks=True):```
`Lib/shutil.py` lines 418 to 422
```py
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
copyfile(src, dst, follow_symlinks=follow_symlinks)
copymode(src, dst, follow_symlinks=follow_symlinks)
return dst```
@buoyant kestrel - shutil.copy returns the original argument [unless it's a directory].
It can return multiple types because it can accept multiple types
@rich moss how is your nurses thing going? ๐ฎ
made anything more interesting?
like the solvable rubiks cube in terminal
i don't know if anything is more interesting, i've been working on it sporadically though
been working on docs for nurses and i added a way to subscribe to widget properties -- so widgets far separated in the widget tree could still observe each other
hey guys who knows class type moduls and functions?
i have a compilation of some projects i've made with nurses: https://www.youtube.com/watch?v=LLI6ANQ6MH4
A showcasing of nurses_2, a terminal graphics library. Source is here: https://github.com/salt-die/nurses_2
for linux users mkdir has an option -p which creates all needed folders to reach a path you want
and for windows New-Item has a -Force flag which does the same
if you do the same from shell
windows has robocopy
robocopy ๐ฎ
short for robust copy
Python has pathlib.Path.mkdir(parents=True)
i used shutils recently to help automate my doc generation
How?
because github needs the index to be in project root or in docs root
so i generate docs in docsrc and copy them over
Yeah, that's why you use GitHub Actions to push to gh-pages
Of course!
i'm very new to sphinx and doc generation and was half tempted to write my own doc generation
Sir,I need to help for my question it about function .
and class
What is your question?
im going to send
There we go
Huh
Apparently they've been saying "Use python -m pip dammit" since 2015
py is just a selector for which python you're going to use
Soo.... Example:
Issue recommends python -m pip - py would be py -m pip
Issue recommends python3.8 -m pip - py would be py -3.8 -m pip
Right
I don't like py
Which is what I try to educate folks on
Then you'd have to tell Windows to stop aliasing python to their specific microsoft store one
I'll just provide a script that removes the alias
Which is more annoying than just telling people to use py which is part of the windows installer
Like
It's no different than having to remember any other quirks when working on different OSs
i just recommend windows people do py -m pip and linux / mac people do python3 -m pip regardless if they have it aliased to just python or not
cuz python3 just works 99% of the time for linux / mac (if they have python 3 installed)
I got to go, see you all soon
@primal bison over here...
umm do I just ask? (Im new to discord)
@primal bison keep typing here
I wanted to know what curses is in python?
@agile portal Could you share your Github so we can look at these projects?
Ah interesting
what you doing @primal bison
Hey @west sun!
It looks like you tried to attach file type(s) that we do not allow (.webarchive). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
ah yesterday i was just playing with a library made by salt-die https://github.com/salt-die/nurses_2
i just made a small thing with it to try it out
except for the thing i made all the other examples are in the repo
someone can help me to transform this vector(1,2,3,4,5,6) in this(1-4-2-5-3-6)?
is a code on a transposed vector
@dreamy basin Erm, do you want to share your screen?
Could not convert "duration" into Duration or ISODateTime.
30 mins is not a valid ISO-8601 datetime string
โ @dreamy basin can now stream until <t:1654288688:f>.
NP ๐
Pro tip: use pathlib.Path to make your paths cross-platform
@tawdry mist 
Er, people streaming bad things ๐
So we had to lock it down, as we're quite a large server
๐
!stream 952414808920162324 30M
โ @tawdry mist can now stream until <t:1654289387:f>.
fastAPI is pretty good
Have you tried using any APIs?
Ah right. If you put those functions in another module, then import that module, you'll need to qualify the names of the functions when you use them.
For example mymodule.myfunction() instead of myfunction().
import mymodule
mymodule.myfunction()
Yeah, you should try to avoid sharing global state between modules.
You'll need to find a way to structure your program so that functions in separate modules don't need to access the same global variables.
Ideally, you want to pass any information a function needs in through its arguments.
Silly example, but e.g. ```py
def add(x, y):
return x + y
print(add(1, 2))
instead of:py
def add():
return x + y
x = 1
y = 2
print(add())
That's new... partially intialized module.
Coming from C, seeing usage before declaration feels so weird!
damn, that keyboard is loud
If you type the command clr in the windows command line, it will clear the screen. You're essentially just calling that function from python using the os.system function.
i personally don't mind it though
Try it out in CMD
Oh right yeah.
Sorry I don't really use Windows much 
Erm, Linux currently yeah.
Or MacOS
Erm
I'm not sure there's any great advantage.
A lot of servers run on Linux, so it's useful to get used to that environment.
If you're regularly configuring servers and so on.
Tbh, I don't know the reason.
Yeah, your keyboard is kind of loud btw 
Not sure what you can do about that.
I think there's a noise suppression setting on Discord on Windows?
It depends on the context really. Do you know about for loops?
You can also use the break statement to break out of a while loop.
That just immediately takes you out of the loop.
Right yes
I might be a good thing to look for opportunities to put the code into a function.
If you have a really long function with lots of loops, you can often find a way to break that function down into smaller functions logically.
Yeah, although it can save you time in the long run.
Sorry I didn't understand that?
Imagine Cup
Oh right, nah I've not heard of it.
Erm, I wouldn't say I'm an expert in multithreading.
Not sure what you mean sorry
Yep
Although if it's, e.g., a web server, usually the web framework you use will take care of threading.
E.g. Flask.
If will just create a new thread for each request that comes in.
This page is a short introduction to concurrency and parallelism: https://composingprograms.com/pages/48-parallel-computing.html
I've got to go in a min
Ah right
Bye!
Cya ๐
Have a nice day/ good night!
Yeah you too 
what do you need
hello can someone help me
Hey @inland wedge!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
Part A: Dropping a Ball!
We all drop the ball occasionally (pun intended)J Let us study how it bounces back though.
The process: Assume that the ball is dropped from a certain height (h) with an initial speed of u m/s. The
ball travels down and as it is acted upon by the gravitational force (g ~ 10m/s2), it hits the ground with a
higher final speed v. This final speed is calculated using the relation v = u+gt. Upon hitting the ground the
ball rebounds. Let us assume that it rebounds without any loss of energy, i.e., it rebounds with the same
speed v. As the ball moves up, it decelerates at the rate of -g (i.e. g ~ -10m/s2) and eventually when it get
back to the original height of h, it stops. It then starts falling back to the ground, emulating the initial fall.
The distance that the ball rises/falls is d = ut + 0.5gt2. (Note: If the initial dropping velocity is 0 m/s then
the ball must rise to the exact same initial height. If the ball it thrown with a certain downward speed,
then it rebounds to a greater height than the initial height.)
Now, write a python program that simulates this process by doing the following: Using the getInput()
function obtain the following values from the user: initial height and initial speed. (Both will be a
positive number). Use the motionSimulator() function to simulate the falling and rising of the ball. In
this you will have to increment time by small steps of 0.04s and determine the precise position of the
ball for these timesteps, plotting it as a function of time. You must print the following data onto the
screen each time the ball reaches the extremum:
- Position (Top or Bottom indicated by T and B, respectively).
- The speed at that position
- Total number of timesteps to be simulated (use 401 timesteps)
- The time interval needed to make that motion from the previous extremum.
- The total time that the ball has been bouncing for since the beginning of the simulation.
- The cumulative number of 0.04s timesteps that have been simulated.
- A graph showing the bouncing of the ball through the entire duration
Hint: You will need the pyplot library to plot graphs. While a detailed introduction to pyplot is in
https://matplotlib.org/stable/tutorials/introductory/pyplot.html, a relevant code that you need
for this exercise is:
import matplotlib.pyplot as plt
plt.plot(time,current_height,'bo')
plt.xlabel('Time [s]')
plt.ylabel('Height [m]')
Use floats for all your variables except the number of timesteps. The output should be printed only
from the main program. Your program output should be in the following format:
Test Case 1: (h=20, u=0)
S. Srinivasan
Copyright ยฉ๏ธ ssriniv@mcmaster.ca
B: 20.00 2.00 2.00 50
T: 0.00 2.00 4.00 100
B: 20.00 2.00 6.00 150
T: 0.00 2.00 8.00 200
B: 20.00 2.00 10.00 250
T: 0.00 2.00 12.00 300
B: 20.00 2.00 14.00 350
T: 0.00 2.00 16.00 400
what is wrong in this code for time_s in range(0,401,50):
final_speed = initial_speed + g * time_interval
current_height = h - (initial_speed + 0.5 * g * time_interval)
time_interval += 2.0
initial_speed = final_speed
if current_height == 0:
final_speed = initial_speed - g * time_interval
current_height = (initial_speed - 0.5 * g * time_interval)
initial_speed = final_speed
time_interval += 2.0
t.append(time_interval)
h_a.append(current_height)
@cold lintel Hey LX, I was reading through chat and the link you sent "composingprogramming.com" or somthing along that url. Out of curiosity i started reading it and it's actually really benefical!
My question is that, can you explain to me;
>>> def sum_naturals(n):
total, k = 0, 1
while k <= n:
total, k = total + k, k + 1
return total
>>> sum_naturals(100)
5050
I dont understand it for a couple of reasons, is total, k = 0,1 does that mean its assigning two variables to 2 values? like total = 0 and k = 1 or is it total and k are both = (0,1)
then i also dont understand the total, k = total + k, k + 1 since im not sure what they're doing originally.
So if you'd be so kind and help me understand this. I'd appreciate it ๐
yes
ig
it assign the values respictively
Hey anyone down for a basic revision
I have a question
What time is this scheduled for?
Yep
Am CST
boys and non boys
In information theory, data compression, source coding, or bit-rate reduction is the process of encoding information using fewer bits than the original representation. Any particular compression is either lossy or lossless. Lossless compression reduces bits by identifying and eliminating statistical redundancy. No information is lost in lossless...
This page describes lossy and lossless compression, and has links to bigger pages for each one
We enhance auto-regressive language models by conditioning on document chunks retrieved from a large corpus, based on local similarity with preceding tokens. With a 2 trillion token database, our Retrieval-Enhanced Transformer (RETRO) obtains comparable performance to GPT-3 and Jurassic-1 on the Pile, despite using 25ร fewer parameters. Afte...
gtg ttyl
it lets you do anything from just a mass rename to a mass rename with regex with even preview of the result
@stiff sand @shrewd wren @cobalt helm OVer here!
Expand
@fresh sail https://git-lfs.github.com/ maybe?
Git Large File Storage (LFS) replaces large files such as audio samples, videos, datasets, and graphics with text pointers inside Git, while storing the file contents on a remote server like GitHub.com or GitHub Enterprise.
Interesting
# backupToZip.py - Copies an entire folder and its contents into
# a ZIP file whose filename increments.
import zipfile, os
def backupToZip(folder):
# Back up the entire contents of "folder" into a ZIP file.
folder = os.path.abspath(folder) # make sure folder is absolute
# Figure out the filename this code should use based on
# what files already exist.
number = 1
while True:
zipFilename = os.path.basename(folder) + '_' + str(number) + '.zip'
if not os.path.exists(zipFilename):
break
number = number + 1
# TODO: Create the ZIP file.
print(f'Creating {zipFilename}...')
backupZip = zipfile.ZipFile(zipFilename, 'w')
# TODO: Walk the entire folder tree and compress the files in each folder.
for foldername, subfolders, filenames in os.walk(folder):
print(f'Adding files in {foldername}...')
# Add the current folder to the ZIP file.
backupZip.write(foldername)
print(foldername)
# Add all the files in this folder to the ZIP file.
for filename in filenames:
newBase = os.path.basename(folder) + '_'
if filename.startswith(newBase) and filename.endswith('.zip'):
continue # don't back up the backup ZIP files
backupZip.write(os.path.join(foldername, filename))
backupZip.close()
print('Done.')
backupToZip('./delicious')
@agile portal here
@fresh sail Is there sound on the stream? [If so, I have a local problem. If not, great.]
no music or anything, but we are talking
Cool. Figured it out.
Does it work ?
Already ?
How does the code navegates thru the os ?
Is it fixed to the py repo ?
we fixit it!
strftime("%m/%d/%Y, %H:%M:%S")
#! python3
# backupToZip.py - Copies an entire folder and its contents into
# a ZIP file whose filename increments.
import zipfile, os
from datetime import datetime
def backupToZip(folder):
# Back up the entire contents of "folder" into a ZIP file.
folder = os.path.relpath(folder) # make sure folder is absolute
# Figure out the filename this code should use based on
# what files already exist.
date_time = str(datetime.now()).strip(' ')
while True:
zipFilename = os.path.basename(folder) + '_' + str(date_time) + '.zip'
if not os.path.exists(zipFilename):
break
# TODO: Create the ZIP file.
print(f'Creating {zipFilename}...')
backupZip = zipfile.ZipFile(zipFilename, 'w')
# TODO: Walk the entire folder tree and compress the files in each folder.
for foldername, subfolders, filenames in os.walk(folder):
print(f'Adding files in {foldername}...')
# Add the current folder to the ZIP file.
backupZip.write(foldername)
print(foldername)
# Add all the files in this folder to the ZIP file.
for filename in filenames:
newBase = os.path.basename(folder) + '_'
if filename.startswith(newBase) and filename.endswith('.zip'):
continue # don't back up the backup ZIP files
backupZip.write(os.path.join(foldername, filename))
backupZip.close()
print('Done.')
backupToZip('./delicious')
s_r = repr(s)
print(s_r)
# 'a\tb\nA\tB'
@fresh sail"%Y%m%d-%H%M%S"
ig yea
https://www.youtube.com/watch?v=P6q4uriw_-g&list=PLIuWuqONUiIpW1oo78-WxB4Hu6oFQvmj4 the scenes change on beat, sick!
I gave an AI 13,000 songs and 38,000 video clips and told it to create a motivational YouTube video about water and this is what it made!
Song:
Single Moment - RomanBelov
Video clips:
Thoxuan99
eisenkern1982
macstevens
astrofreq
notperfectpic
taorbu
Vimeo-Free-Videos
vrogov
Relaxing_Guru
RSK-Nature
krzys16
MixailMixail
Engin_Akyurt
Ambient_Nat...
Yeah ๐
was that intentional?
holy man, thats rlly cool
How did you do it ?
"pay me bitch" ๐ญ
Wow , that was intense
@agile portal what IDE are you using?
what is -> None ?
ฤฑ cant speak
why?
Also, there is no sharing on the screen.
@fresh sail
@limpid coral
time break?
!voice
Voice verification
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
There is, #voice-verification to verify
How does gravity work @agile portal
How did you defined it @agile portal
How does it work
But how do you make the variable or function gravity work as gravity ?
Hey
@all
One question
How do you create the base for the game
Lets say the background its a square of x.height and y.width
|------------------|
!e
top="|"+("-"*10)+"|"
side="|"+(""*10)+"|"
bottom="|"+("_"*10)+"|"
print(top)
print(side)
print(side)
print(side)
print(bottom)
@shrewd wren :white_check_mark: Your eval job has completed with return code 0.
001 | |----------|
002 | ||
003 | ||
004 | ||
005 | |__________|
!e
top="|"+("-"10)+"|"
side="|"+(" "10)+"|"
bottom="|"+("_"*10)+"|"
print(top)
print(side)
print(side)
print(side)
print(bottom)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | top="|"+("-"10)+"|"
003 | ^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
!e
top="|"+("-"10)+"|"
side="|"+(" "10)+"|"
bottom="|"+("_"*10)+"|"
print(top)
print(side)
print(side)
print(side)
print(bottom)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | top="|"+("-"10)+"|"
003 | ^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
!e
top="|"+("-"10)+"|"
side="|"+(""*10)+"|"
bottom="|"+("_"*10)+"|"
print(top)
print(side)
print(side)
print(side)
print(bottom)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | top="|"+("-"10)+"|"
003 | ^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
!e
top="|"+("-"*10)+"|"
side="|"+(" "*10)+"|"
bottom="|"+("_"*10)+"|"
print(top)
print(side)
print(side)
print(side)
print(bottom)
@shrewd wren :white_check_mark: Your eval job has completed with return code 0.
001 | |----------|
002 | | |
003 | | |
004 | | |
005 | |__________|
!e
top="|"+("-"*10)+"|"
side="|"+(" "*10)+"|"
bottom="|"+("_"*10)+"|"
print(top)
print(side)
print(side)
print(side)
print(bottom)
@shrewd wren :white_check_mark: Your eval job has completed with return code 0.
001 | |----------|
002 | | |
003 | | |
004 | | |
005 | |__________|
!e
top="|"+("-"*10)+"|"
side="|"+(" "*10)+"|"
bottom="|"+("_"*10)+"|"
def cube:
print(top)
print(side)
print(side)
print(side)
print(bottom)
print(cube*2)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | def cube:
003 | ^
004 | SyntaxError: invalid syntax
Oh
!e
top="|"+("-"10)+"|"
side="|"+(" "10)+"|"
bottom="|"+("_"10)+"|"
cube= (print(top),
print(side),
print(side),
print(side),
print(bottom))
print(cube2)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | top="|"+("-"10)+"|"
003 | ^^^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
!e
top="|"+("-"*10)+"|"
side="|"+(" "*10)+"|"
bottom="|"+("_"*10)+"|"
def cube:
print(top)
print(side)
print(side)
print(side)
print(bottom)
print(cube*2)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | def cube:
003 | ^
004 | SyntaxError: invalid syntax
!e
top="|"+("-"*10)+"|"
side="|"+(" "*10)+"|"
bottom="|"+("_"*10)+"|"
cube={ print(top)
print(side)
print(side)
print(side)
print(bottom)}
print(cube*2)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | cube={ print(top)
003 | IndentationError: unexpected indent
!e
top="|"+("-"*10)+"|"
side="|"+(" "*10)+"|"
bottom="|"+("_"*10)+"|"
cube={ print(top);
print(side);
print(side);
print(side);
print(bottom)}
print(cube2)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | cube={ print(top);
003 | IndentationError: unexpected indent
!e
top="|"+("-"*10)+"|"
side="|"+(" "*10)+"|"
bottom="|"+("_"*10)+"|"
cube={ print(top);
print(side);
print(side);
print(side);
print(bottom)}
print(cube2)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | cube={ print(top);
003 | IndentationError: unexpected indent
Im trying to create an object
Name cube , the object is the one above and print it 2 times
!e
top="|"+("-"*10)+"|"
side="|"+(" "*10)+"|"
bottom="|"+("_"*10)+"|"
cube={ print(top);
print(side);
print(side);
print(side);
print(bottom)}
print(cube*2)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 5
002 | cube={ print(top);
003 | IndentationError: unexpected indent
@shrewd wren :warning: Your eval job has completed with return code 0.
[No output]
cube="["+i+"]"
for i in range(20)
print(cube)
!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.
!e
cube="["+i+"]"
for i in range(20)
print(cube)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | for i in range(20)
003 | ^
004 | SyntaxError: expected ':'
!e
cube="["+i+"]"
for i in range(20):
print(cube)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'i' is not defined. Did you mean: 'id'?
!e
cube=(f"["+i+"]")
i=0
for i in range(20):
print(cube)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'i' is not defined. Did you mean: 'id'?
!e
cube="["+i+"]"
i=0
for i in range(20):
print(cube)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'i' is not defined. Did you mean: 'id'?
!e
cube=(f"["+0+"]")
for 0 in range(20):
print(cube)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | for 0 in range(20):
003 | ^
004 | SyntaxError: cannot assign to literal
!e
cube=(f"["+num+"]")
num=0
for num in range(20):
print(cube)
@shrewd wren :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'num' is not defined. Did you mean: 'sum'?
!e
priceTax = * 12%
@tired sluice :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | priceTax = * 12%
003 | ^
004 | SyntaxError: invalid syntax
!e
priceTax = * 12 %
@tired sluice :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | priceTax = * 12 %
003 | ^
004 | SyntaxError: invalid syntax
!e
priceTax = + 12 %
@tired sluice :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | priceTax = + 12 %
003 | ^
004 | SyntaxError: invalid syntax
@tired sluice :warning: Your eval job has completed with return code 0.
[No output]
yay
def list_sum(num_List):
if len(num_List) == 1:
return num_List[0]
else:
return num_List[0] + list_sum(num_List[1:])
print(list_sum([3, 5, 8, 9, 9]))
i managed to fix all the bugs in the code now that i'm not streaming (it was just 2 simple things that i'm too sleepy to quickly notice) T-T anyways gonna go sleep now
gnight
sick
!e
price_tax = 1 / 10 * 100
print(price_tax)
@sullen chasm :white_check_mark: Your eval job has completed with return code 0.
10.0
ู ุตุทูู
@shrewd wren :warning: Your eval job has completed with return code 0.
[No output]
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!*
@primal bison :white_check_mark: Your eval job has completed with return code 0.
hiii
!e
def cl(pr):
return pr/10*100
print(cl(100))
@sullen chasm :white_check_mark: Your eval job has completed with return code 0.
1000.0
!e
Number=int(input("What is the cube u want"))
print(NumberNumberNumber)
?
!e
Number=int(input("What is the cube u want"))
print(Number* Number *Number)
@royal trout :x: Your eval job has completed with return code 1.
001 | What is the cube u wantTraceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
bruh dicord ownt let me do it
!e
Number=int(input("What is the cube u want"))
print(NumberNumberNumber)
@royal trout :x: Your eval job has completed with return code 1.
001 | What is the cube u wantTraceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
e
@keen mirage over here
why
Voice verification
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@keen mirage
yeah following
@high cosmos Over here!
!voice
Voice verification
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@fresh sail How to start? Just follow this book from the beginning?
hi
Itโs easier to put print statements everywhere
Wellโฆ Iโll use both, then gradually phase out the prints
Hi, how can I stream?
does anyone know why my python cant run mySQLdb?
@agile portal what are you doing , hello ?
Hello
Not ment to be unpolite
Dou you know about bf
Brain fuck
The language
It was hilarious
How can that work
In a computer ?
CLOJURE IS GOOD
Just like haskell and job
imma dip for now
@calm bay I'll hit u up when I get back my perms
@vernal snow https://github.com/DavinderJolly/MyConfigs
where should I start here ?
@robust osprey whats goin on?
@unique meteor over here
don't have much to say. just dropping by to see what's up
@fresh sail keep up the good work.
niice
@glad stratus
I can help you
bad book for learn coding
maybe make it python map_it.py
I think it is good can you suggest something better?
hmm
depends on what you want to learn step by step or specific
I think tokens are the keywords in programming. Like 'for' in for loop could be a token. I'm not sure though. Let me google it
I'm on windows 11 rn. I never noticed it, but the search bar is indeed huge
i gtg too. later!
top 10 reasons to switch to linux
https://alternativeto.net/software/noisetorch/about/ @limpid coral you can also try this for noise suppression
thanks, will take a look at this shortly!
The journey to recreate a trending twitter post and cure lockdown boredom.
โถ Support the channel on Patreon and get access to exclusive tutorials : https://www.patreon.com/ValemVR
โถ Join the discord channel : https://discord.gg/5uhRegs
USEFUL LINKS
See Greg Madison Original Video : https://youtu.be/sv6T-tg6RL4
Download Ikea Model for fr...
import requests
def get_stream(url):
s = requests.Session()
headers = {
"User-Agent": "curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8h zlib/1.2.3 libssh2/0.15-CVS"
}
with s.get(url, headers=headers, stream=True) as resp:
for line in resp.iter_lines():
if line:
print(line.decode())
url = "http://parrot.live"
get_stream(url)
An extension to parrot.live, with support for more animations! http://ascii.live - GitHub - hugomd/ascii-live: An extension to parrot.live, with support for more animations! http://ascii.live
welcome back
!Dad
Mutable Default Arguments
Default arguments in python are evaluated once when the function is
defined, not each time the function is called. This means that if
you have a mutable default argument and mutate it, you will have
mutated that object for all future calls to the function as well.
For example, the following append_one function appends 1 to a list
and returns it. foo is set to an empty list by default.
>>> def append_one(foo=[]):
... foo.append(1)
... return foo
...
See what happens when we call it a few times:
>>> append_one()
[1]
>>> append_one()
[1, 1]
>>> append_one()
[1, 1, 1]
Each call appends an additional 1 to our list foo. It does not
receive a new empty list on each call, it is the same list everytime.
To avoid this problem, you have to create a new object every time the
function is called:
>>> def append_one(foo=None):
... if foo is None:
... foo = []
... foo.append(1)
... return foo
...
>>> append_one()
[1]
>>> append_one()
[1]
Note:
โข This behavior can be used intentionally to maintain state between
calls of a function (eg. when writing a caching function).
โข This behavior is not unique to mutable objects, all default
arguments are evaulated only once when the function is defined.
^
lel
@agile portaltook me forever to @ you lmao bc of your non -ascii name
but anyways- bye!
that's the point
xD
hello guys ๐
Hello guy's
I'm building a discord robot now, does anyone have any theoretical ideas? I mean, what options should I put on the robot?
what is going on in live coding?
pip install --user requests
py -m pip intsall --user requests try this
On Tuesdays and Thursdays, Magical Girl (Fury) goes through a section of the text Automate the Boring Stuff, and does a kind of work along/read along workshop
That's very nice
winget install pip
I thought pip gets bundled with Python nowadays.
It does
on windows it's python instead of py
And if it isn't, you should do py -m ensurepip
why you don't use anaconda that have installed lots of package, isntead of pure python interpter
Are you getting these errors?
quit()
you can run download pip package in the console that will insatlled pip
40 more pages of this legal document left to read.
I saw some url or command to download it
hello guys can i pls ask u something?
py -m ensurepip should be the modern way to get or make sure you have pip properly installed
what type are the operation signs? @buoyant kestrel
Fury spelled python incorrectly
set PATH=%PATH%; C:\Python3\Scripts
python -m ensurepiup --default-pip
C:\Users\megatronic>pip install --user requests
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
Requirement already satisfied: requests in c:\users\megatronic.local\lib\python3.9\site-packages (2.28.0)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\megatronic.local\lib\python3.9\site-packages (from requests) (1.26.9)
Requirement already satisfied: idna<4,>=2.5 in c:\users\megatronic.local\lib\python3.9\site-packages (from requests) (3.3)
Requirement already satisfied: charset-normalizer~=2.0.0 in c:\users\megatronic.local\lib\python3.9\site-packages (from requests) (2.0.12)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\megatronic.local\lib\python3.9\site-packages (from requests) (2022.6.15)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
Huh, haven't seen that flag before
import requests
import requests
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'
python -m ensurepip --default-pip
After what he put, do python -m pip list
C:\Users\megatronic>python -m ensurepip --default-pip
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
Looking in links: c:\Users\MEGATR~1\AppData\Local\Temp\tmpzhmc_xcl
Requirement already satisfied: setuptools in c:\msys64\mingw64\lib\python3.9\site-packages (62.4.0)
Requirement already satisfied: pip in c:\msys64\mingw64\lib\python3.9\site-packages (22.1.2)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
See if requests even shows up there
why is this happening?
Empty DataFrame
Columns: []
Index: []
And honestly, you may just have to uninstall/reinstall Python
i have never installed packages using --user
Make sure you get the installer from https://python.org rather than from the Microsoft store
For some reason the one from the MS Store always causes issues
It's msys2, trying to find out what that is
@buoyant kestrel what type are operation signs?
Can you list the package directory?
dir c:\msys64\mingw64\lib\python3.9\site-packages
I'm not sure, Shaken
python -m pip list
I don't know what type they'd be classified as
you forgot to check all the fields set path and etc during the installion i suppose
Add to PATH isn't needed so long as you use py
@buoyant kestrel is that ur real face?
It is
C:\Users\megatronic>python -m pip list
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
Package Version
certifi 2022.6.15
charset-normalizer 2.0.12
idna 3.3
pip 22.1.2
requests 2.28.0
setuptools 62.4.0
urllib3 1.26.9
wheel 0.37.1
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
WARNING: Ignoring invalid distribution -ip (c:\msys64\mingw64\lib\python3.9\site-packages)
It shouldn't be using msys
the pip is installed, the system can't see it
Someone said that the tilde char '~' can cause this issue in site-packages folder
Still need to manually remove MSYS2 from %PATH%, I think.
Open start menu. Typing "envir" should search for it.
Rate my joke programm
Might need to relog to use the new %PATH%.
@lunar delta @silent star @digital blade overt here
@buoyant kestrel so if till now we could use css+htm+javascript, now that we can write python tags in html, can we replace javascript with python?
@buoyant kestrel ?
might have to restart the editor for bs4 import to be recognized? @fresh sail
Not sure but seems some dependency issue... @glass forum
just made my own language whose syntax is like:
depression kill_yourself(a,b)
{
if(!a)
return "Dont Die!";
else
return "Die!";
}
cry kill_yourself(1,0);
basically u declare a function with depression
a variable with pain
cry is equivalent to print
anything else should i change?
opinion requested
for i in range(10):
time.sleep
print(i)```
Hey @crystal notch!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
import time
for i in range(11):
time.sleep(1) #1 sec delay
print(i)
func test() {
val, err := BadFn1();
if err != nil {
return;
}
val, err = BadFn2();
if err != nil {
handle(err);
}
OofyFn3(val);
}
In python you choose what error type to skip
Javascript just skips it
In the two years since I've posted I want off Mr Golang's Wild
Ride , it's made the rounds time and
time again, on Reddit, on Lobste.rs, on HackerNews, and elsewhere. And every...
yikes
cool
why lgbtq logo trash
shut up
@calm bay, what are you two working on?
ps1 emulator
ah, nice
@gloomy lily ping me when ur back, hope u didn't die
Hey could I ask you guys a question?@gloomy lily
SQUARE
Nice
I need help
@gentle dock you can type here
ah ok
i think so
i have not, new windows installation, gimme a sec
im still doing it, you can move ahead tho
was fine for me
im good
Hello @agile portal sir can i have permission to speak i have dought?
ok no worries can i ask my dought here?
Is doctype mandatory?
what will happen if i dont write <Doctype.html> ?error?
sure
it was all basics for me ^^
same
yup
@agile portal i got a question
so you know how we made a form
what if i want the submit button to link to a new page
like websites usually do
I guess you would usually redirect to that page
@grand kettle #โ๏ฝhow-to-get-help Yeah, just toss the question into one of the help channels
We're in the middle of a workshop so in here isn't the best place to ask specific questions right now
@agile portal so wt was actually supposed to happen?
yes but for now i'm just teaching basics of javascript so we will learn that later
lol
@agile portal could you please quickly recap just a little bit, from when you opened the script tag
i dont get it tbh
@agile portal is this happening bcoz there is another event in the background?
i think
@agile portal think theres a typo in email-content, in your html file
@primal bison
@agile portal thanks for the session, is this recorded?
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
@agile portal https://getbootstrap.com/docs/4.0/layout/grid/
@agile portal is this recorded?
@agile portal all break point can be used
what
pretty sure i replied but no that was not recorded
though i'm probably gonna do one just for javascript the language itself tommorow (8 pm ist) if you wanna show up
dwm.c:742 just need to note something down before I restart xorg
JavaOS is an operating system based on a Java virtual machine and predominantly used on SIM cards to run applications on behalf of operators and security services. It was originally developed by Sun Microsystems. Unlike Windows, macOS, Unix, or Unix-like systems which are primarily written in the C programming language, JavaOS is primarily writt...
HotSpot, released as Java HotSpot Performance Engine, is a Java virtual machine for desktop and server computers, developed by Sun Microsystems and now maintained and distributed by Oracle Corporation. It features improved performance via methods such as just-in-time compilation and adaptive optimization.
Log4Shell (CVE-2021-44228) was a zero-day vulnerability in Log4j, a popular Java logging framework, involving arbitrary code execution. The vulnerability had existed unnoticed since 2013 and was privately disclosed to the Apache Software Foundation, of which Log4j is a project, by Chen Zhaojun of Alibaba Cloud's security team on 24 November 2021...
โThere are only two kinds of languages: the ones people complain about and the ones nobody uses.โ
ADD 1 TO x
ADD 1, a, b TO x ROUNDED, y, z ROUNDED
ADD a, b TO c
ON SIZE ERROR
DISPLAY "Error"
END-ADD
ADD a TO b
NOT SIZE ERROR
DISPLAY "No error"
ON SIZE ERROR
DISPLAY "Error"
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-STRING PIC X(15) VALUE 'ABCDACDADEAAAFF'.
PROCEDURE DIVISION.
DISPLAY "OLD STRING : "WS-STRING.
INSPECT WS-STRING REPLACING ALL 'A' BY 'X'.
DISPLAY "NEW STRING : "WS-STRING.
STOP RUN.
!e print("\7")
@frank minnow :white_check_mark: Your eval job has completed with return code 0.
!e print("\7")
@frank minnow :white_check_mark: Your eval job has completed with return code 0.
Do you think the corsair hs80 wireless are getting a reboot? I am considering getting them to improve my audio
especially for calls
Also do you all transnight when your projects are due?
Love it
never have i seen html code look so perfect :')
ok
!e
code
nooo actually the code is so symmetrical
@primal bison https://code.visualstudio.com/
yess downloading it as we speak
ello
Hello!
I thought the semi-colon thing was inconsistent
Whether it's needed or not
I'm trying to remember if there's a way to hot reload or auto reload whenever you save your code so that the browser shows changes as it goes
Please Excuse My Dear Aunt Sally
So far so good
All good on my end
I am consfused in pre increment and post increment/decrement๐ตโ๐ซ
Can you please re explain again in short way
Can i speak?
i know
๐ถ
i've made it
Same
we could check if it's divisible by 15
@agile portal if you could change your webpage bg to black that would be very nice cuz I keep getting flashbanged
Much better
Gotta go, but I appreciate the lesson!
does alert function can have buttons like Ok and cancel? @agile portal
sorry but I have heared API for the first time here...
i m in 10th standard
can you tell me what is API stands for?
point noted
what?
@agile portal wanna stop here for today before canvas? It's been 2+ hours so
Ah ok
Aight imma head out
Thanks for the session
code from the workshop
ggs^^
!e
list1 = [[8388902, 6], [8388901, 8], [8388922, 22]]
list2 = [[8388902, 6], [8388901, 10], [8388922, 22]]
for sublist1, sublist2 in zip(list1, list2):
if sublist1 != sublist2:
print(sublist1, sublist2)
@balmy pasture :white_check_mark: Your eval job has completed with return code 0.
[8388901, 8] [8388901, 10]
๐ <- An ant named Anthony.
๐ <- The same ant, but named Bob.
Anty aliasing.
I regret that I only saw this now, I appreciate your joke very much
it made me giggle
Jetbrains Mono
ok,ty
!kindling
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.
Hello friends, I have been working on a cryptographic program for the last year. After many iterations I have concluded to a final program ,but there is a problem. The program is very slow (It would take my laptop 3 months running 24-7 to finish) but there is little to no optimization I can do to the code rather than changing the algorithm. The only solution I could think about is distributing the workload to other computers but I don't know where to find such source of cheap computing power. If you can help me with the problem I face ,please contact me : )
How's everyone today?
Yay for payday or Nay? ๐
Hey @amber kettle!
It looks like you tried to attach file type(s) that we do not allow (.html). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Did my first coding. I feel like I have ascended into a higher dimension.
OH MY GOD OH MY GOD
;0
Hello everyone. I have been learning how to code in python from an online platform. I have an assignment which deals with text based files and string manipulation. I have been stuck with this assignment for 2 days, if anyone can help me out it would mean a lot. Please contact me if willing to help ๐
@hybrid steeple yes How can i help you?
@nocturne jay I have been learning how to code in python from an online platform. I have an assignment which deals with text based files and string manipulation. I have been stuck with this assignment for 2 days, if you can help me out it would mean a lot.
yes i understand the assignment target and code
like you want to search a particular string or something?
@hybrid steeple?
No. Basically i have a text file containing a set of dialogues from a script. I have to Find out the number of unique dialogue speakers in the sample conversation and Create a new text file by the name of the dialogue speaker and store the unique words
spoken by that character in the respective text file.
Hey @hybrid steeple!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
text file will work to...
Hey @hybrid steeple!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
you can copy the textfile at: https://paste.pythondiscord.com/
then just send me the url
do not forget to save
ok so all the char left to the colon are the characters meaning you can just find the characters left of the colon.
i am pretty new to coding. Can you write the code if possible?
i can import that right?
yes
okay, i know how to do that.
as it will be long code, i i wil post updates
can you come to #help-avocado
@hybrid steeple?
lol
The classic 'Hello world'
Hello friends
i have a probelm
problem
int Alter = 19; // andere datentypen funktionieren damit auch (switch case)
switch (Alter) {
case 17: System.out.println("17 Jahre alt"); break;
case 18: System.out.println("18 Jahre alt"); break;
case 19: System.out.println("19 Jahre alt"); break; //break ist fรผr die reihenfolge wichtig, sonnst werden werte vertauscht
default: System.out.println("anderes alter"); break;
}
String Film = "StarWars";
switch (Film) {
case "HarryPotter": System.out.println("Falsches Buch"); break;
case "WarriorCats": System.out.println("Falsches Buch"); break;
case "Qualityland": System.out.println("Falsches Buch"); break;
case "StarWars": System.out.println("Richtiges Buch"); break;
default: System.out.println("Kein treffendes Buch erschienen"); break;
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error, insert "... VariableDeclaratorId" to complete FormalParameter
at Program.main(Program.java:4)
CODEGINITY!
You have a syntax error maybe missing semicolon or whatever on that line
import sys
def register(cls):
def setup(bot):
bot.add_cog(cls)
print(f"Registered {cls.__name__}")
mod = sys.modules[cls.__module__]
mod.setup = setup
return cls
list_1 = []
m = 0
while m <= 21: # where m is the length of the `output_id` series.
list_1.append(m)
m = m + 1
# print(list_1)
print('now, time to slice list_1 candy')
print(list_1[1:21:6])
####################
list_2 = []
n = 0
while n <= 21:
list_2.append(n)
n = n + 1
print('now, time to slice list_1 candy')
print(list_2[2:21:6])
# time to merge these lists together in the right order:
for i in list_1:
list_1.insert(i + 1, list_2[i])
print(list_1)
####################
list_3 = list(sum(zip(list_1, list_2), ()))
print(list_3)
!e
a = [1, 3, 5, 7]
b = [2, 4, 6, 8]
print(list(sum(zip(a ,b) , ())))
@alpine parcel :white_check_mark: Your eval job has completed with return code 0.
[1, 2, 3, 4, 5, 6, 7, 8]
e!
list_1 = []
m = 0
while m <= 21: # where m is the length of the `output_id` series.
list_1.append(m)
m = m + 1
# print(list_1)
print('now, time to slice list_1 candy')
print(list_1[1:21:6])
####################
list_2 = []
n = 0
while n <= 21:
list_2.append(n)
n = n + 1
print('now, time to slice list_1 candy')
print(list_2[2:21:6])
####################
list_3 = list(sum(zip(list_1, list_2), ()))
print(list_3)
!e
list_1 = []
m = 0
while m <= 21: # where m is the length of the `output_id` series.
list_1.append(m)
m = m + 1
# print(list_1)
print('now, time to slice list_1 candy')
print(list_1[1:21:6])
####################
list_2 = []
n = 0
while n <= 21:
list_2.append(n)
n = n + 1
print('now, time to slice list_1 candy')
print(list_2[2:21:6])
####################
list_3 = list(sum(zip(list_1, list_2), ()))
print(list_3)
@alpine parcel :white_check_mark: Your eval job has completed with return code 0.
001 | now, time to slice list_1 candy
002 | [1, 7, 13, 19]
003 | now, time to slice list_1 candy
004 | [2, 8, 14, 20]
005 | [0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21]
the desired output: [1,2, 7,8, 13,14 19,20]
i figured it out btw
uwu
import antigravity
@urban reef you can dc now if you want to.
@urban reef been in #off-topic-lounge-text for almost a day now
maybe get some sleep @urban reef
that person talked?
exactly, they didn't
e!
!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!*
!eval print("Hello, World!")
@marble jolt :white_check_mark: Your eval job has completed with return code 0.
Hello, World!
!eval eval("print('Hello, World!')")
@marble jolt :white_check_mark: Your eval job has completed with return code 0.
Hello, World!
!hel0
@robust mirage :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | if i = 9:
003 | IndentationError: unexpected indent
!eval eval print(โHello worldโ)
@carmine wasp :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | eval print(โHello worldโ)
003 | ^
004 | SyntaxError: invalid character 'โ' (U+201C)
!eval print('Hi')
@terse magnet :white_check_mark: Your eval job has completed with return code 0.
Hi
!eval a = []
b = input('How many cats do you have?')
a.append(b)
if len(a) > 2:
print('cool')
!eval for x in range(1, 100): for y in range(1, 10): print(f"{x} * {y} = {x * y}")
code
!eval for x in range(1, 100): for y in range(1, 10): print(f"{x} * {y} = {x * y}")
wait
class Hashtable:
def __init__(self):
self.max=10
self.arr=[[] for i in range (self.max)]
def get_hash(self,keys):
sum=0
for c in keys:
sum=sum+ord(c)
return (sum%self.max)
def __setitem__(self,key,val):
h=self.get_hash(key)
found=False
for index,element in enumerate self.arr[h]:
if element[0]==key and len(element)==2:
found=True
self.arr[h][index]=(key,val)
if not found:
self.arr[h].append((key,val))
def __getitem__(self,key):
h=self.get_hash(key)
for i in self.arr[h]:
if i[0]==key:
return i[1]
return self.arr[h]
```
for index,element in enumerate self.arr[h]:
^
SyntaxError: expected ':'
this error
enumerate(self.arr[h]):
class Hashtable:
def __init__(self):
self.max=10
self.arr=[[] for i in range (self.max)]
def get_hash(self,keys):
sum=0
for c in keys:
sum=sum+ord(c)
return (sum%self.max)
def __setitem__(self,key,val):
h=self.get_hash(key)
found=False
for index,element in enumerate(self.arr[h]):
if element[0]==key and len(element)==2:
found=True
self.arr[h][index]=(key,val)
if not found:
self.arr[h].append((key,val))
def __getitem__(self,key):
h=self.get_hash(key)
for i in self.arr[h]:
if i[0]==key:
return i[1]
return self.arr[h]
try this
thanks it worked
new to this funtion
enumerte()
didnt knew to use bracket
it is function so it has parenthesis
@solid arch Australia is in Australia
May be they are makinig tea as well!
possible
how dogs respond to "fetch": runs for some random object
how programmers respond to "fetch": PROCEED TO OPEN IDE AND TYPE A JS FETCH API CALL
Makes me wonder if p1.eat.call(p2, "ice-cream") works.
Mm. Things to never do!
So defer alone is not enough?
Hey @ember breach!
It looks like you tried to attach a Python file - please use a code-pasting service such as https://paste.pythondiscord.com
if (mode ==='public') {
showDetails();
Call a function here to show the post details
showDetails();
} else{
#Call a function here to hide the post details
hideDetails();
}
my code is not running lol
doing this practice from codeacademy
Pretty clear so far
yeah
it is
i did everything clearly
but idk why its not executing
lemme try using replit
Oh right. Can you use endPath please? Not having it matching bugs me a little!
I assume there is an endPath anyway.
Not a channel for asking questions.
oh
Forgot to copy the "#", I think
Pretty neat
Thanks for the lesson! Making something graphical is always more interseting
Estimating pi in a browser...!
arigato^
It's Friday!
class Hashtable:
def __init__(self):
self.max = 10
self.arr = [[] for i in range(self.max)]
def get_hash(self, keys):
sum = 0
for c in keys:
sum = sum + ord(c)
return (sum % self.max)
def __setitem__(self, key, val):
h = self.get_hash(key)
found = False
for index, element in enumerate(self.arr[h]):
if element[0] == key and len(element) == 2:
found = True
self.arr[h][index] = (key, val)
if not found:
self.arr[h].append((key, val))
def __getitem__(self, key):
h = self.get_hash(key)
for i in self.arr[h]:
if i[0] == key:
return i[1]
return self.arr[h]
def __delitem__(self, key):
h = self.get_hash(key)
for index, element in enumerate(self.arr[h]):
if element[0] == key:
print(f"delete element in {index}")
del self.arr[h][index]
filename='nyc_weather.csv'
f=Hashtable()
f.arr
with open(filename,'r') as fileobj:
for line in fileobj:
date,temp=line.split(',')
temp = int(temp)
f.arr[date]=temp
@sinful salmon
are you online
class Hashtable:
def __init__(self):
self.max = 10
self.arr = [[] for i in range(self.max)]
def get_hash(self, keys):
sum = 0
for c in keys:
sum = sum + ord(c)
return (sum % self.max)
def __setitem__(self, key, val):
h = self.get_hash(key)
found = False
for index, element in enumerate(self.arr[h]):
if element[0] == key and len(element) == 2:
found = True
self.arr[h][index] = (key, val)
if not found:
self.arr[h].append( (key, val))
def __getitem__(self, key):
h = self.get_hash(key)
for i in self.arr[h]:
if i[0] == key:
return i[1]
return self.arr[h]
def __delitem__(self, key):
h = self.get_hash(key)
for index, element in enumerate(self.arr[h]):
if element[0] == key:
print(f"delete element in {index}")
del self.arr[h][index]
filename='nyc_weather.csv'
f=Hashtable()
count=0
with open(filename,'r') as fileobj:
for line in fileobj:
try:
date,temp=line.split(',')
temp = int(temp)
except ValueError:
pass
else:
f.arr[count]=(date,temp)
count+=1
print(f.arr)
class Hashtable:
def __init__(self):
self.max = 10
self.arr = [[] for i in range(self.max)]
def get_hash(self, keys):
sum = 0
for c in keys:
sum = sum + ord(c)
return (sum % self.max)
def __setitem__(self, key, val):
h = self.get_hash(key)
found = False
for index, element in enumerate(self.arr[h]):
if element[0] == key and len(element) == 2:
found = True
self.arr[h][index] = (key, val)
if not found:
self.arr[h].append( (key, val))
def __getitem__(self, key):
h = self.get_hash(key)
for i in self.arr[h]:
if i[0] == key:
return i[1]
return self.arr[h]
def __delitem__(self, key):
h = self.get_hash(key)
for index, element in enumerate(self.arr[h]):
if element[0] == key:
print(f"delete element in {index}")
del self.arr[h][index]
filename='nyc_weather.csv'
f=Hashtable()
count=0
with open(filename,'r') as fileobj:
for line in fileobj:
try:
date,temp=line.split(',')
temp = int(temp)
except TypeError:
pass
except ValueError:
pass
else:
f.arr[count]=(date,temp)
count+=1
print(f.arr)
[('Jan 1', 27), ('Jan 2', 31), ('Jan 3', 23), ('Jan 4', 34), ('Jan 5', 37), ('Jan 6', 38), ('Jan 7', 29), ('Jan 8', 30), ('Jan 9', 35), ('Jan 10', 30)]
@warm dome can't replicate your issue
grokking algorithms
nope
@warm dome
can't replicate
getting same input both times
same output*
with or without
@primal bison hello btw ๐
hey :>
wanna play 1 match of either coding game or bomb party before i go? xD
binarysearch?
;-; sure go ahead and beat me at your expert level questions man
i m stupi-
no you're not >w>
Gotta go. It was good to see you around again Maro!
sounds good
@calm bayhttps://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
This document describes the 3.17.x version of the language server protocol. An implementation for node of the 3.17.x version of the protocol can be found here.
i tried reading that at some point but I'm stupid
@night lily are you online?
Can anybody help me out? I am stuck at a problem?
yeah in what?
:incoming_envelope: :ok_hand: applied mute to @tropic imp until <t:1656827560:f> (9 minutes and 59 seconds) (reason: discord_emojis rule: sent 21 emojis in 10s).
The solution is to learn how to use computer and send screenshots
hello
what happens in the voice chat 0-0
what happens in voice chat 0 stays in voice chat 0
thats very sus 0_0
really weird
!voice
Voice verification
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Thank you for flying @buoyant kestrel air
@white mica
non
are you not able to be voice verified cause of the restrictions
pool = Pool(processes=8)
tasks = len(tasks)
for _ in tqdm.tqdm(pool.imap_unordered(handle, tasks), total=len(tasks)):
pass
if __name__ == '__main__':
รงa va
Are you using translate?
nope.
made my first code with the help of copilot, adds a crosshair to the middle of the screen and the window showing it is fully passthrough with fullscreen game support, FPS too.
Noice
Wow Really Nice
!voice
Voice verification
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
hi i need some help with finding definite integral
im pretty new to python
i can explain my need, can someone with experience in finding definite integral over a range in a xarray help me
You have to follow all the steps
Like i am trying to do
I only have 8 messages
i need to get 50
If i type 20 per day
in 3 days im verified
im not cleary clarified if its only to get 50 messages or you have to do all the tasks
to get the voice verification
well
you
hve
to
get
the
job
done
its simple as that
are you kidding without 50 messages per day it wont verify?
no, 50 messages total outside of bot command channels. you also need a few days activity. read #voice-verification
hello there
it seems like i have to get the 50 messages so i can speak ๐ฅฒ
wym
guess its so people can share their screen while coding
and voice chat
there's a voice channel next to this text channel
with the same name
but i can't unmute myself because i'm still not verified
learning to code and not having voice privilege's is kinda terrible but it is needed to keep people from spamming vc's like children.
like right now I'm new to coding completely and I chose python to start with and functions are giving me a bit of trouble figuring out all the proper ways to word and how to fix the errors in my practice however I have found that there are some members who are extremely helpful regardless if I can communicate through vc or not.
hi
yes
i don't have stupit role
yes
just send msg?
sure
like โโ!voiceverify or โโ!verify
it just says that i need to send more msg to verify
!voice
Voice verification
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Voice verification
Canโt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Voice Gate failed
You are not currently eligible to use voice inside Python Discord for the following reasons:
โข You have sent less than 50 messages.
bot says
stupit system
22
86
-1 -1 -1 -1 -1 -1 -1 -1
-1 0 0 0 7 0 0 0
-1 0 -1 -1 -1 -1 -1 -1
-1 0 -1 -1 107 -1 -1 -1
-1 0 0 0 0 -1 -1 -1
-1 -1 -1 -1 -1 -1 -1 -1
Ia
di da
minions
pie thong
Hi
Pie Thong
hello @slim dust
@lunar skiff hello
i don't have a mic
how are you doing
i was making a password cracker for metamask
how about you
ok
but isn't it dangerous to link you account with a programming language
ok
ok
can you share your code
i wu=ould like to see it
would
ok
no problem
do you use arduino
