#voice-chat-text-0
1 messages · Page 201 of 1
base_dir = Path(r'C:/Users/danie/')
path = base_dir / "example.fit"
pathlib.Path attempts to be OS-independent in its interfaces
Hello @somber heath !
except explicitly for converting from and into OS representation
would you be able to help me out
with something
How would you be able to replicate a website like: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/assigning-the-value-of-one-variable-to-another
but with python
the test system?
how much do you trust the users?
not at all
as for isolation, there exist per-language sandboxes and some generic ones
generic approach normally involves containerisation of some sort
I'd expect namespaces/cgroups or its derivatives (including Docker) to be used there
the sandboxing itself is just docker no?
just a message broker
do you know sql
nope.
wnat about you @vocal basin
I have experience with SQL but not much
I prefer using ORMs or simpler data storage mechanisms
if a have a sql table from one of the items i get the rowid how can I get that same rowid in a other table
rowids across tables aren't correlated, usually
FK from one table's column to another's rowid column could be a thing
i.e. enforcing that referencing table's rows are each associated to at most one row in referenced table
how are the two tables related?
I have 2 table one of the table have the users login the other one have some information's on the account how can I connect them
@vocal basin suppose I am the only user
and I am not going rm rf everything
how would I go about recreating something like freecodecamp, but for python input/output?
I've had several ideas
but none of them are elegant
does -f suppress errors?
!e
print(5+5)
@boreal abyss :white_check_mark: Your 3.12 eval job has completed with return code 0.
10
@vocal basin
login or userid, but not rowid
!e
from subprocess import check_output
print(check_output('touch /test'.split()))
make my own id dont use the rowid
@vocal basin :x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 2, in <module>
003 | print(check_output('touch /test'.split()))
004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
005 | File "/lang/python/default/lib/python3.12/subprocess.py", line 466, in check_output
006 | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
007 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
008 | File "/lang/python/default/lib/python3.12/subprocess.py", line 548, in run
009 | with Popen(*popenargs, **kwargs) as process:
010 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
011 | File "/lang/python/default/lib/python3.12/subprocess.py", line 1026, in __init__
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/M3KFS5F7VZD2GQHYYR3EUKREVM
!e
from subprocess import check_output
print(check_output('rm -rf /dev/'.split()))
@vocal basin :x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 2, in <module>
003 | print(check_output('rm -rf /dev/'.split()))
004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
005 | File "/lang/python/default/lib/python3.12/subprocess.py", line 466, in check_output
006 | return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
007 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
008 | File "/lang/python/default/lib/python3.12/subprocess.py", line 548, in run
009 | with Popen(*popenargs, **kwargs) as process:
010 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
011 | File "/lang/python/default/lib/python3.12/subprocess.py", line 1026, in __init__
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/QBTFWJZSZQGPAFW666JGEIORAY
well, that's one way to deal with that, I guess
No such file or directory: 'rm'
!e
from shutil import rmtree
rmtree('/dev/')
@vocal basin :x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 2, in <module>
003 | rmtree('/dev/')
004 | File "/lang/python/default/lib/python3.12/shutil.py", line 769, in rmtree
005 | _rmtree_safe_fd(fd, path, onexc)
006 | File "/lang/python/default/lib/python3.12/shutil.py", line 680, in _rmtree_safe_fd
007 | onexc(os.rmdir, fullname, err)
008 | File "/lang/python/default/lib/python3.12/shutil.py", line 678, in _rmtree_safe_fd
009 | os.rmdir(entry.name, dir_fd=topfd)
010 | OSError: [Errno 30] Read-only file system: 'shm'
!e
from shutil import rmtree
rmtree('/etc/')
@vocal basin :x: Your 3.12 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 2, in <module>
003 | rmtree('/etc/')
004 | File "/lang/python/default/lib/python3.12/shutil.py", line 769, in rmtree
005 | _rmtree_safe_fd(fd, path, onexc)
006 | File "/lang/python/default/lib/python3.12/shutil.py", line 697, in _rmtree_safe_fd
007 | onexc(os.unlink, fullname, err)
008 | File "/lang/python/default/lib/python3.12/shutil.py", line 695, in _rmtree_safe_fd
009 | os.unlink(entry.name, dir_fd=topfd)
010 | OSError: [Errno 30] Read-only file system: 'ld.so.cache'
I think that's, like, only part of what disallows it
the real general reason is:
current user lacks the privileges
within the container even
assuming code isn't ran as root
basic logic of a runner could be:
clear everything that a sandboxed program can read/write
receive next request
run the code as a restricted user
either wait for the completion or kill on timeout
gather results, send somewhere else
repeat
stopping certain programs could be difficult
!voiceverify
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
it could've been just time-limited
I learned C# and Python at the same time
CLR (C#'s thing) and JVM are VMs
in some sense
there https+git option for pip or something similar
@ebon mist yes, registries normally have a full list of packages
it's just an html file
relatively large one
!e
print(sorted('a2df.898-2f_h'))
@vocal basin :white_check_mark: Your 3.12 eval job has completed with return code 0.
['-', '.', '2', '2', '8', '8', '9', '_', 'a', 'd', 'f', 'f', 'h']
compared based on ord values of characters
list(map(ord, s1)) < list(map(ord, s2)) should be same as s1 < s2
something literally called "project interpreter", iirc
settings > project > project interpreter
in normal PyCharm workflow, manually adding new interpreters is only necessarily when fixing/updating a project
PYTHONUNBUFFERED=1
affects stdout/stderr/etc.
THANK YOU!!!
@wind raptor can i get stream permssions
!stream 750306431223201793
✅ @toxic arch can now stream until <t:1697283986:f>.
im gonna start coding
a gui
yes python
do you know how i can also get the gui
in thje stream
nah ive only really used tkinker
alright thne
yeah for this game
it just takes long to loasd
its loading all of the containers
yeah
i use a cache
its for a game
right now im just trying to figure out what theese files mean
nah just making custom levels
its offline
well i hope so
ive been looking at this for a while and i cant wrap my head around it
the only thing ive been able to tell is the area loading
mind blowing
its from the same
ai
i think
nice car
brooo
i use interactions-py
do you think i should get rid off the tearoff?
@obsidian dragon i used kivy
@wind raptor do you know how i can make a new image with some text on it
pillow
ohh its there
just very small
do you know how i can make it fill the image
oh so i need to make a font
to change its size?
thx
hmm but how can i make it filll the image
cause the text is tiny
i think im gonna have to do some logic
to tell how big the font should be
I am making a macro/automation program and I do not know what else to add? Anyone have any ideas?
Here are some of the things I have already added
make a hold key
got that
not spam key, hold
yea I have that
I wish I could share screen
ask @wind raptor
@wind raptor can I?
!stream 720148755973799937
✅ @vivid gorge can now stream until <t:1697286634:f>.
@obsidian dragon i used kivy a while back
wanna see it?
i love tkinker
(i dont)
@obsidian dragon i use the linux cmd thing
i forgot what its called
nboo its built in windows
it starts with w
wsl
thats it
Windows Subsystem for Linux
to build kivy for android
no clue how
lmao
its not
a calcualtor
its a save editor
yeah i gave up on it
a long time agao
werid its not working in tkinker
the image
preview = Image.new('RGB', (512, 512),(0,0,0))
draw = ImageDraw.Draw(preview)
draw.text((0, 0), "nice Car",(255, 255, 255),ImageFont.truetype("arial.ttf",128))
tk.Label(preview_view,image=ImageTk.PhotoImage(preview)).pack()
you
not showing the function
@vivid gorge
@somber heath do you know why this isnt working correctly
its just a grey square
PROGRAM ON CHROMEBOOK TOO
I showed it
ITS JUST GREY
man i cant wait
making a level editor in tkinker gonna be fun!
(not)
I would get into web programing but for it to be useful I would have to buy a domain
im just doing an empty image
moved the text_color specification outside the draw.text function, ensuring that the text is drawn in white on the black background
just testint stuff rn
this is probably just some left over compiled stuff
maybe i can find out this debug
menu
is this markdown?
this is NOT markdown
Ya, I was slow on the uptake.
i dont think this game is apporate for this server so im gonna stop streaming now
Right now the way my program works is you type in a bunch of commands. The way it does that right now is by having one function manage running all of that with the exception of looping. To make it worse in the one function there is just a whole lot of elifs. Right now this is the best I have because I started this project when I was very new to python. I have tried to simplify code but there is just soo much.
gonna see how it looks ingame
for powershell i think it's activate.ps1
In my program to automate things you just type in a lot of commands and they get executed when it's ran. Would it be better to tokenize or stick with what I have which is arguments
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
afk
@toxic arch I've had a tinker with tkinter. Following an example from elsewhere which ought to work...doesn't. I packed and I mainlooped and it doesn't want to display. Tkinter isn't something I'm particularly good at, but I am a little perplexed.
I know I've got image stuff to show up in tkinter, before, so I'm buggered if I know why it's being stupid.
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Hello
im back
hi
I've been watching videos about Python and I didn't understand anything. I'm going to start studying with chatgpt and I saw a video saying is it worth it?
lol totaly forgot i was here
lol
Ahh, best of luck to you!
with the same push to talk button
lol. that could have ended badly 🤣
could you hear me speak?
I just got there
kk
The problem with that is that it likes to hallucinate sometimes and you pretty much need to fact check everything it tells you and make sure it is still the current way to do things
What is the best way to study py today?
If you need a second source for info on something, or review on something you kind-of know already, I'd use it
I prefer Udemy 40+ hour well-structured courses. I learn best by watching good videos and following along / deviating from them.
The problem is that I'm Portuguese
YouTube is fine, but the 5-10 hour all-in-one courses are just not long enough to really learn something all that well.
So you are trying to find Portuguese content?
@wind raptor
I hear you and am talking back
I know my mic is working
I was just talking with someone else
I'll brb. I have to trim my dog's nails quick.
!stream 456056298522279946
✅ @hasty blaze can now stream until <t:1697301670:f>.
discord past
!paste
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
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.
!stream 456056298522279946
✅ @hasty blaze can now stream until <t:1697302022:f>.
!stream 360284932469293056
✅ @ebon mist can now stream until <t:1697303829:f>.
S-lang
s lang
yes
Windows 12 in the cloud
no internet, no OS
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
i have one question
age = 7
if age < 5:
print("You're too small!")
else:
print("You're all grown up!!")
if you are over 5 years old I use IF but if you are less than 5 I use ELSE
.
else is for when I don't have the q requirement and request
.
if is for if you have more than the requirement
sure?
.
!stream 500168097852948482 2w
✅ @desert wolf can now stream until <t:1698517590:f>.
chris
What's up?
Can you explain to me better a part of the loop where the range is?
And see if what I sent you is right the code and the explanation
@desert wolf What are you creating?
one variable need "?
" "
nut
hey how long do u guys think it will take to learn enough python for ai automation
has someone made a file explorer type thing for the terminal?
What is the difference between else and elif
else doesnt have support for expressions. elif is like a second if statement if the first (or before) fails.
age = 7
if age < 5:
print("You're too small!")
else:
print("You're all grown up!!")
In this code you could also use elif instead of else
!e ```py
age = 18
if age > 5:
print(True)
if age > 6:
print(True)
if age > 7:
print(True)
if age > 8:
print(True)
if age > 9 :
print(True)
if age > 10:
print(True)
if age > 11:
print(True)
if age > 12:
print(True)
if age > 13:
print(True)
if age > 14:
print(True)
if age > 15:
print(True)
if age > 16:
print(True)
if age > 17:
print(True)
if age < 18: # less than 18 btw
print(True)
else:
print(False)
@scarlet halo :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | True
002 | True
003 | True
004 | True
005 | True
006 | True
007 | True
008 | True
009 | True
010 | True
011 | True
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/XZB75MQROYS5VCCAA4XOE7FCPU
True
True
True
True
True
True
True
True
True
True
True
True
True
False
elif would only return 1 True
age = 18
if age > 18:
print("you're a sore fucking loser")
else:
print("hey buddy grab a drink :laughing: ")
I didnt understand srry
its fine that was just a stupid example thingy
basically elif only runs if the previous if statement is False
and else cant have expressions
like you cant do: else x == y: but youll have to do elif x == y:
So if the if ago is false, use if elif for true
Okay this time I realized
so if ... elif(s) ... else (optional)
If the IF command is false, the next true and elif
if the if is true no elifs will run either
If IF is true the next and else?
no if if is true no other elifs or elses will be run
If IF true I don't need to add any of them
elses and elifs are good to have incase your if is false
Age = 20
if age < 19:
print("ok")
else:
print("okkk")
In this code I use elif
sure?
no that should be else
theres no expression
in the elif
so its useless
should be else
elif 1==1:
else:
see?
Why should it be else and not elif
your elif doesnt have an expression/condition
therefore it doesnt know whether to run or not
and it gets confused
and might throw an error
Can you give an example of each
Age = 20
if age < 19:
print("ok")
else:
print("okkk")
Age = 18
if age < 19:
print("ok")
elif:
print("okkk")
Sure?
if 1==2:
quit(1) #doesnt execute as 1 is not equal to 2
else:
quit(0) #runs because previous if is false
if 1==2:
pass
elif 1==3:
pass
elif 1==1:
print("success")
If false and elif false but last elif true
as i said there can also be an "else:" after the last elif
correct
If the first if is false I use elif false and dps a correct?
you should try reading some more about if statements as theyre pretty similar for each programming language.
Ok
or you can ask some more experienced people in #python-discussion or #1035199133436354600
Ok thanks for trying to help me
good
kool kool
hello bro
there's nobody online
i hear you
you hear me, that's good
how are you?
im learning physics lol
what kind
that's nice
yeah but i cant understand it lol
i dont know how to type exponential numbers
python recognize this?
this question makes no sense, no offense
klai linux its a thingy for hacking
been gettin popukar in my school and people gettin hacked left and right
kali linux is a linux distribution with pre-installed tools for penetration testing
how can i prevent it
what does that even mean, "people getting hacked"
idk something ot do w kali linux
ik i sound like a 60 year old rn
but im just aksin about it
you offered zero details, your question couldn't be more vague
maybe they are using open wifi networks on school
thats why they are getting hacked
well i asked a kids
and he said
he can hack someone by watching their stream on discord
like is that even possible?
im completely new to python i have no idea id it possible or not
so its not even possible?
im not an expert but i think that almost everything is possible
but time consuming for what?
stealing fb account from an 12 year old?
worthless
almost every account right now uses 2 step verifications
like your cellphone
hello File
Do you use 2FA ? If not, use it
Is something wrong with this?
`import math
G=6.67pow(10,-11) #Universal Gravitational Constant 6.673 x 10-11 Nm2/kg2[4]
M1=5.98pow(10,24) #Mass of the first Object
M2=70 #Mass of the second Object
D=6.38*pow(10,62) #Distance between the two objects.
Step1=M1M2
Step2=Step1G
Step3=math.sqrt(D)
Step4=Step2/Step3
Result=Step4
print(Result)`
Can someone explain to me what a function is
a function is basically
something that you make to use a certain chunk of code over and over again throughout the code
usually used for big projects
def myFunction(): [your code]
then you call the code by myFunction
a function can have parameters, like this:
def myFunction(param): [tab]x = param * 2 return x
then you would call it like myFunction(2) and it will return 4
!e ```py
def times_two(v):
return v * 2
result = times_two(3)
print(result)```
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
6
@cosmic bison what's the question being discussed?
running a concurrent processes with django I think?
so django spawns a process or.. ?
just ASGI + uvicorn
whatever the regular uwsgi does -- likely involves multiple workers too
for IO-bound task, ASGI will be better for most, if concurrency is the issue (as compared to WSGI)
for CPU-bound task, you shouldn't be doing them inside a web server
offload to a separate worker process, connect them via a message queue
o
what happened lmao
no idk what to add
yeah
no
how are ya
😬
ayoo
review this beautiful code @cosmic bison
valid_fruits = ['apple', 'orange', 'banana', 'kiwi', 'blueberry']
fruits = []
for _ in range(10):
fruit = input('Enter a fruit (apple, orange, banana, kiwi, or blueberry): ')
is_valid_fruit = False
for valid_fruit in valid_fruits:
if fruit == valid_fruit:
is_valid_fruit = True
break
if is_valid_fruit:
fruits.append(fruit)
else:
print('Invalid fruit.')
apple_count = 0
orange_count = 0
banana_count = 0
kiwi_count = 0
blueberry_count = 0
for fruit in fruits:
if fruit == 'apple':
apple_count += 1
elif fruit == 'orange':
orange_count += 1
elif fruit == 'banana':
banana_count += 1
elif fruit == 'kiwi':
kiwi_count += 1
elif fruit == 'blueberry':
blueberry_count += 1
print('Apples: ' + str(apple_count))
print('Oranges: ' + str(orange_count))
print('Bananas: ' + str(banana_count))
print('Kiwis: ' + str(kiwi_count))
print('Bluberry: ' + str(blueberry_count))
can confirm, is code
ikr
@rare belfry 👋
hey
I don't have persmission to talk
!voice 👇
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
:incoming_envelope: :ok_hand: applied timeout to @karmic sage until <t:1697339627:f> (10 minutes) (reason: newlines spam - sent 110 newlines).
The <@&831776746206265384> have been alerted for review.
I fixed the bug 😎
@trail sphinx 👋
Hey @somber heath
@storm furnace 👋
@whole bear 👋
!e
import numpy as np
import pandas as pd
speed = pd.Series([32,111,138,28,59,77,97])
mean = speed.sum()/speed.count()
variance = (((speed-mean)**2).sum())/speed.count()
#or
speed2= [32,111,138,28,59,77,97]
vary= np.var(speed2)
var=speed.var()
print(var,variance, vary)
@boreal abyss :white_check_mark: Your 3.12 eval job has completed with return code 0.
1670.9523809523807 1432.2448979591834 1432.2448979591834
????????????????????????
@tulip gyro it's very fun to use!
do you use c# or the godot language
how similar is the godot with python
?
@tulip gyro it's for learning
it's why physicists keep delving into smaller and smaller particles
then make a JIT-compiler to sometimes not run it on VM and make everything even more confusing
(into the very small of string theory even)
or for mathematicans and foundation of math
@lavish rover you're my soul person
useful => can get relied on => sad situation
does something like haskell/f# allow to just do this instead of if?
condition "condition is true" "condition is false"
it's my own language
Ocean?
Ocen
ocen
^
pretty much, I don't want to be the one maintaining shit forever
"even if you don't know language design, you can still contribute to, for example, documentation's CSS"
it is the best way to learn something. Just not the fastest or easiest
Actually I'm wrestling with the temptation to build certain things just to understand them..
Studying code would be great if there were better tools to annotate code and to study code.
We definitely don't have enough of those
what spider said
it's not the most efficient if your goal is to just get a high level understanding
there isn't "the best" way at all, but usually making something yourself improves knowledge compared to not making
or even useful for most things
@vocal basin I would rather find a good explanation of something instead of building it myself.
A good explanation will almost never give you a taste for all the actual real technical issues
it tells you what is being done, very rarely why it is, or why it is not done other ways
use the thing => learn what it needs to do (and what you'd need to do if you were to create it)
build the thing => learn how what the implementation challenges are
study your and other's implementation => learn how it affects the use and design
like, every interaction with the concept/system/etc. helps with other interactions
and there isn't a step-by-step guide to it (asynchronous learning)
@cosmic bison what's your test-coverage ?
@cosmic bison I was expecting a percentage but okay
But also - there's a personal factor. I really enjoy the process of figuring out how to implement things - not just knowing how they work
it makes me understand the nuances and complexities of the issues, and why people might decide to do it a certain way
for @cosmic bison it would be great to not take anything for granted, challenge all possible assumptions, write tests for them and eventually you should find the issue
yeah, that's why prefer the thing (which I most often see with Rust) where whoever presenting the design also includes previous (simpler/move naïve) versions and why they were rejected;
Rust "Book"s do this, Steve Klabnik's talks on async have that
@lavish rover what's your test coverage? for the ocen language
measured in what?
percentage basically
of the grammar, like how much of the grammar is hit by the tests
so, basically "lines"
let's say yes?
I don't track it, I don't think that's really a meaningful statistic IMO
yeah, statement/expression/line coverage, even if too basic, is still useful
I also don't really have tooling to track it if I wanted to, considering my language is implemented in itself
it kindof is because anything that's not covered by tests is UB(undefined behavior).
that's probably why C++ has so much UB, but also because it's a very complex language..
especially when it's <100%
not necessarily UB
it's defined, just not in tests
and some things are inherently untestable
such as?
IO isn't UB; UB, as a term, applies more to "you failed and the system is free to do whatever it wants"
any interactions with external systems
"you can't unit-test IO" is basic level for issue;
many aspects (mostly, ones that anyone actually cares about) of a system require testing in a larger setting;
some IO can be tested by increasing the scope that you're dealing with (from unit to integration) but that also decreases the control;
still IO test generation is performed using fuzzers
@wind raptor ))
im waiting you)
It's 5am here.
@hasty blaze
echo cancellation
@charred torrent 👋
the Netherlands
can someone explain to me what a function is, i had to see it in videos and i didn't understand it very well
A function is a kind of object which can be considered as being a collection of code. A function can be called upon to be run when required. Here is an example.
!e ```py
def func(): # This is where we say this function is referred to by the variable, func
print('Hello.')
print('Goodbye.')
func() # This is a "call". It causes the function to run.
func()
func()```
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | Hello.
002 | Goodbye.
003 | Hello.
004 | Goodbye.
005 | Hello.
006 | Goodbye.
A function also has an "inbox" and a few different, but one main "outbox".
def function() :
print ("hey ")
print("hey world")
function()
function()
function()
He'll send Hey and Hey World 3 times
!e ```py
def func(parameter):
print(parameter)
argument = 'Hello.'
func(argument)```
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
Hello.
What's that inside Parameter
A function can have parameters. These parameters are variables. The variables are assigned to the objects given in the call. The objects given in the call are called arguments.
Here, I call func. The argument, a string, 'Hello.', has parameter assigned to it within the function.
I'm going to try to make something that has a function
For later reading: The LEGB rule. Write it down.
Functions also have, as mentioned, an outbox.
!e ```py
def func():
return 123
print(func())```
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
123
The object given to return, here 123, replaces the call to the function.
The call becomes/evaluates/transforms into the object returned.
The function still runs, but when it hits return, the object is passed out of the function and into where the call is.
When you hit return, the function terminates.
!e ```py
def func():
print('A')
return
print('B')
func()
func()```
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | A
002 | A
All functions that complete, return.
If nothing is explicitly given to be returned, the object None is returned.
!e ```py
def a():
'Code goes here blah blah.'
def b():
return
print(a())
print(b())```
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | None
002 | None
We see this in some other calls we can make, to print, for example.
!e py print_return = print('Hello.') print(print_return)
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | Hello.
002 | None
We just don't usually assign variables to such function calls/their return.
Functions can also have more than one parameter. It can get complicated.
!e ```py
def add(a, b):
return a + b
print(add(5, 2))
print(add(50, 2))```
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | 7
002 | 52
Arguments and parameters are both separated by commas.
Though you can nest other structures that do have commas.
!e ```py
def func(a, b):
print(a)
print(b)
func((1, 2), 3)```
@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | (1, 2)
002 | 3
I still have two arguments, it's just that the first one is a tuple.
ty
Making a bit more sense, now?
yes
Smashing.
mods can i stream please
Is this a library and modules?
just import genius
But import just doesn't happen
@whole bear DONT LISTEN TO IT
its cringe
@dusky lynx im a mod
<@&831776746206265384>
voice
Where is my Chris
@scarlet halo
original_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
chunk_size = 3
split_lists = [original_list[i:i + chunk_size] for i in range(0, len(original_list), chunk_size)]
Stop.
@hasty blaze is there something you need?
yes
@hasty blazeor are you just harassing poeple
there was a problem
@hasty blaze describe the issue
yesterday
i need show my screen
and stop tagging me
@hasty blaze @Chris is not the only person to give access adn try screen shots of code copy
!e
print('hello world')
@somber field :white_check_mark: Your 3.12 eval job has completed with return code 0.
hello world
@obsidian dragon We're all good here, thank you. 🙂
is the bot conected to a server that runs all the code????
he dont know that we are friends
We're not.
we are
It runs something called Snekbox. It's a sandboxed environment.
Unable to convert 'It runs something called Snekbox. It's a sandboxed environment.' to valid command, tag, or Cog.
.source
yeah... just checked it out if you saw the code
!source
That one.
#bot-commands
I'm fond of you.
omg
!e
import time
while True:
time.sleep(1)
r u friends
@somber field :warning: Your 3.12 eval job timed out or ran out of memory.
[No output]
I'll take it :dab:
@somber field
?
do that there not here
sry
just to avoid clutter
Python tutorial for beginners full course
#python #tutorial #beginners
⭐️Time Stamps⭐️
#1 (00:00:00) Python tutorial for beginners 🐍
#2 (00:05:57) variables ✘
#3 (00;17;38) multiple assignment 🔠
#4 (00:20:27) string methods 〰️
#5 (00:25:13) type cast 💱
#6 (00:30:14) user input ⌨️
#7 (00:36:50) math functions 🧮
#8 (00:40:58...
Practical data skills you can apply immediately: that's what you'll learn in these no-cost courses. They're the fastest (and most fun) way to become a data scientist or improve your current skills.
?
Utrecht Hill Ridge (Dutch: Utrechtse Heuvelrug) is a ridge of low sandhills that stretches in a direction from southeast to northwest over the Dutch province of Utrecht and over a part of North Holland. The total length of the region is about 50 km. It covers an area of approximately 23,000 hectares. The part of the ridge in North Holland is com...
Utrechtse Heuvelrug National Park is a national park in the Dutch province of Utrecht. It covers the southern part of the Utrecht Hill Ridge. When it was founded in 2003, the park covered 6,000 ha (15,000 acres) of heathlands, shifting sands, forests, grass lands and floodplains. In 2013 the park was extended to 10,000 ha (25,000 acres), adding ...
Daniël Lohues - Prachtig mooie dag
Sfeerimpressie van de mooiste gebieden van Drenthe, muziek Daniël Lohues- Groeten uit Drenthe
Hout Moet
Vol nieuwe juweeltjes, alles gespeeld op vintage akoestische instrumenten. Handgemaakte, ambachtelijk muziek. In zijn typisch Lohuesiaanse teksten neemt de schrijver ons mee naar zijn gedachtenwereld. B...
@terse needle
Biryani
Biryani () is a mixed rice dish originating among the Muslims of South Asia. It is made with spices, vegetables, rice, and usually some type of meat (chicken, beef, goat, lamb, prawn, or fish). In some cases without any meat, and sometimes with eggs and potatoes.Biryani is one of the most popular dishes in South Asia, as well as among the diaspo...
do anyone knows about sicprts on python
sicprts?
yes
you mean scripts?
how to fix that
:(
pip install requests
how
same problem
what i do :(
there is nothing we can do
nah
it's a money printer
loock at me username
3letters only
yes
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
🥲
i joined right now
so that's why i cna't talk
i just wnaa get cool usernames
:(
you said you wanted to sell the usernames
i wnaa get cool one
i was seling
i sold 505_
1200
$
:)
yes, that's the problem
def x(age=14):
pass
xDDD
HE said it
he said it
i am from the middle east soo ....
how to fix my problem guys do u know a disocrd server or smothing
:(
i need to send 50 massge to just talk
beacuse i am new
lol
@pulsar light
where u from
:)
i know it
i am from plastine
hahah
:)
<3
hbibi
same
ofc
my honey
habibi
dude the world is bad rn
yeah bro )
k
Snarky Puppy feat. Väsen - Shapons Vindaloo
From Snarky Puppy's live CD/DVD - "Family Dinner - Vol. Two"
Stream/Download/CD/Vinyl: https://orcd.co/familydinnervol2
©GroundUP Music 2016
Written by André Ferrari
Arranged by André Ferrari, Michael League & Snarky Puppy
Recorded and filmed at Esplanade Studios in New Orleans, LA, February 12-14, 2...
human = "false"
if human = "False" print("i am a robot")
:
flase
!e
human = "false"
if human == "False":
print("I am a robot")
else:
print("I am a human")
human = "False"
if human == "False":
print("I am a robot")
else:
print("I am a human")
@wind raptor :white_check_mark: Your 3.12 eval job has completed with return code 0.
001 | I am a human
002 | I am a robot
oh ok
thsnk u
thank u
No problem
what is
happend
this
i cannot talk in the mic
tf
haha
its funny why is this happening
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
did you just open your home directory in vscode?
?
I've read all this and I know at least what I'm doing now? Variables and Data Types
Control Structures
Functions
Libraries and Modules
Problem Practice
Small Projects
Study the documentation
Learn How to Debug
Python Community
Advanced Language
What's the next thing I should do?
object oriented programming, i.e. classes
I would like to do 2 things but 1 has nothing to do with Python and another I don't know how to do
I liked to create a website or a program
(I don't know how to create this)
What kind of program would you want to create?
Also, have you actually written any code?
even doing print("hello world")
I've written some basic ones
I don't know
you have to decide that first. Is it a terminal app or GUI app? What will it do? etc.
What's the difference
Terminal app is just text in the console. So basically just uses print and input
GUI is what most apps you use have. GUI is a Graphical User Interface. So it has buttons, text, tabs, headers, images, sliders, etc.
GUI is a lot more difficult. But python does have the Tkinter module for making very basic GUI's
Which one do you recommend
how long have you been writting code?
and what level experience would you rate yourself? beginner, noob, novice, intermediate, advanced?
Short time
okay. I would recommend making simple terminal apps then
beginner or noob
after a few simple projects, you should take a look at tkinter for basic UI
when you get comfortable doing both, then just research whatever you want from there
you could lookup how to make discord bots, website backends (using django), more complex UI with pyQT/pyside, More complex terminal apps using curses, sockets, or anything else that interests you
learning a bit of pygame is a good way to start learning more stuff while still keeping it basic. But do that once you feel comfortable making a few basic tkinter apps on your own.
what is tkinder and can give me code suggestions to create
you could create a basic GUI calculator app. That is a good first project for tkinter
what is tkinder
I don't know what it is
?
a library built into python that lets you make GUI
that is what it is
It's hard to create a game like this one from GIF
start simple
probably don't do that yet
but when you feel comfortable that could be a cool project
I try to make a calculator or I try to create basic codes
try to make a calculator with tkinter. That is a simple project that should help expand your knowledge
I don't know how to make calculator
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
hundreds if not thousands of tutorials on tkinter
take that knowledge and then use it to create your calculator
I can't just give you the code. You won't learn that way
if you have a specific tkinter question then I can help. But if you don't take the first steps, I can't do much
@shy raft would it be weird to have __putdiv__ as an equivalent to __idiv__ in my lang (and the same for all the other inplace ops)
nah i think that could be quite useful
okay cool
ah ok
@cosmic bison Is Tkinter used to create the window?
I want to make it so my command will only work with people in allowed.json but idk what to put in either
yes and the GUI
Spider I have no idea how to create a calculator
import your_mom
I want to make it so my command will only work with people in allowed.json but idk what to put in either
Ok but the problem is creating the calculator (code) I don't know anything about creating a calculator
Yes, I use it and have used it many times but I don't know how to program a cal
its funny
instead of doing calculator
i decided
to create a gui for a login system that would log you into an image rescaler
as my first ever project
i dont think so
think about what a calculator does
what do you do
when youopen the app
I do math
and how do you do math
S1. Why don't programmers like nature? It has too many bugs.
2. Why do programmers always mix up Christmas and Halloween? Because Oct 31 == Dec 25.
3. Why do programmers prefer iOS development? Because on iOS, there are no Windows or Gates.
4. Why did the programmer go broke? Because he used up all his cache.
5. Why was the JavaScript developer sad? Because he didn't Node how to Express himself.
There are 10 kinds of people in the world. Those who understand binary and those who don’t.
With the numbers and. + x - : and press = result
I'm going to start studying tkinter
exactly
you input
you get one button to run the command of its corresponding number
and the operators the same
@cedar briar #pedagogy message
oh
@cedar briar whats up
same
eating
but having trouble with knowing how to call them
im not a coder at all, im an electronics engineer by profession and im currently working on a script to toggle tags bits in the PLC, i just need little help
@cedar briar
sweet
@cedar briar what kind of project would be great for working on and learning from? in python
#pedagogy message
first book has plenty of exercises
!paste
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 Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
sweet! ty @wise loom
@cedar briar can you see
Yes. Send it to me over a DM. I'll take a look at it later. Gotta sleep in some time.
@wise loom i also send you the code
yeah I had a look, looks like you want to use threads..
you should not ping people randomly, we have a help system for this. bu what do you need help with?
i have a moment
Sorry
itll be quick
do you know why I get a permission denied error
for this?
I mean it works for another folder in the same directory so
idk why it just wont work
I dont know, never used that package before. maybe the folder name parses incorect, maybe it needs to have a file like object instead of a string, since strings easaly breaks on windows
or maybe it needs the file and not the folder
maybe you dont have access to that folder, there are many things that can go wrong
But I have the same access to another folder in the same directory
here look
I used Bias 0 sec 9_27 before and it worked but when I put the same line of code as before here, it just doesn't grant me permission regardless of the folder name
well if you used it before, then that folder is now locked to that instance where you used it
you cant have two applications working with the same data
restart your computer and try again
but i was under the impression that they weren't the same data. After all they are different FOLDERS
Let me restart my computer rq
well, permission errors can be many things, instead of having me guess, you should just restart and see
I am still getting the same error @dire folio
I am very worried
I dont know if this suggests the project is like, corrupted maybe?
#❓|how-to-get-help is a great place to ask for help, maybe someone knows, but do share what your doing and using
no, machine issue
or, windows issue
it might be code issue as well, but i dont know what your doing, you should share that as well in a help thread
third party file reading packages are hard to troubleshoot when you dont know what they are
@craggy sundial 👋
@somber heath hello there. I'm new here. do not have permision for voice chat yet
!voice 👇
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
reading now the instructions
@somber heath ahh ok. I just joined yesterday , so not yet 3 days. and I'm sure I didn’t have 50 messages on the server aswell by now
@somber heath I need help 😄
I am creating an small ecomm with django and htmx + tailwind and I have problems with stripe webhooks
@somber heath my app is saving different payment_intent_id in the database than the one stripe is asking for
thanks
@somber heath very complex this Discord channel ... a lot of options 🙂
@somber heath what is your main field ?
@somber heath so instead of photoshop you are using python to manipulate images ?
@somber heath I am trying to do everythin and I'm good at nothing. still looking for the exact path of IT that I m loving the most and will choose one
@daring wind 👋
Hi
@pine ridge 👋
!voice 👇
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
!voice
i have not 50 messages ^^
sorry
whatsup
Do you now linux server
but
i try to install a website
Ctrl + S
loooooool
def __repr__(self) -> str:
repr = "\n"
for r, row in enumerate(self.grid):
repr += " "
for c, digit in enumerate(row):
if not digit:
digit = "."
repr += f"{digit} "
if c % 3 == 2:
repr += " "
repr += "\n"
if r % 3 == 2:
repr += "\n"
return repr
>>> grid = [
... [5, 3, 0, 0, 7, 0, 0, 0, 0],
... [0, 0, 0, 1, 9, 5, 0, 0, 0],
... [0, 0, 0, 0, 0, 0, 0, 6, 0],
...
... [8, 0, 0, 0, 6, 0, 0, 0, 3],
... [4, 0, 0, 8, 0, 3, 0, 0, 1],
... [9, 0, 0, 0, 2, 0, 0, 0, 6],
...
... [0, 6, 0, 0, 0, 0, 2, 8, 0],
... [0, 0, 0, 4, 1, 9, 0, 0, 5],
... [0, 0, 0, 0, 8, 0, 0, 7, 9],
... ]
>>> sudoku = Sudoku(grid)
>>> sudoku.solve()
>>> print(sudoku)
5 3 4 2 7 6 9 1 8
6 7 8 1 9 5 3 4 2
2 9 1 3 4 8 5 6 7
8 5 7 9 6 1 4 2 3
4 2 6 8 5 3 7 9 1
9 1 3 7 2 4 8 5 6
1 6 9 5 3 7 2 8 4
7 8 2 4 1 9 6 3 5
3 4 5 6 8 2 1 7 9
def _is_valid(self, d: int, r: int, c: int) -> bool:
return all(
(
self._is_valid_row(d, r),
self._is_valid_col(d, c),
self._is_valid_box(d, r, c),
)
)
``````php
2115349 function calls (2082272 primitive calls) in 0.899 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
33078/1 0.122 0.000 0.899 0.899 main.py:69(solve)
297467 0.158 0.000 0.777 0.000 main.py:56(_is_valid)
297467 0.113 0.000 0.401 0.000 main.py:48(_is_valid_box)
297467 0.288 0.000 0.288 0.000 main.py:49(<listcomp>)
297467 0.073 0.000 0.168 0.000 main.py:44(_is_valid_col)
297467 0.095 0.000 0.095 0.000 main.py:45(<listcomp>)
297467 0.032 0.000 0.032 0.000 main.py:40(_is_valid_row)
297467 0.017 0.000 0.017 0.000 {built-in method builtins.all}
1 0.000 0.000 0.000 0.000 cProfile.py:118(__exit__)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
if (
d in row
or d in [_row[c] for _row in self.grid]
or d
in [
self.grid[_r][_c]
for _r in range(r // 3 * 3, r // 3 * 3 + 3)
for _c in range(c // 3 * 3, c // 3 * 3 + 3)
]
):
``````php
176038 function calls (142961 primitive calls) in 0.214 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
33078/1 0.138 0.000 0.214 0.214 main.py:69(solve)
47110 0.047 0.000 0.047 0.000 main.py:86(<listcomp>)
95848 0.029 0.000 0.029 0.000 main.py:84(<listcomp>)
1 0.000 0.000 0.000 0.000 cProfile.py:118(__exit__)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
@versed bane 👋