#voice-chat-text-0
1 messages · Page 99 of 1
freecodecamp any good?
that may depends on what type of app you want to build
you can build everything with any framework, so just look for mastery something, I would go to nextjs
`javac Main.java`
@hoary kayak👋
waves
def decor(func):
def wrap():
print("============")
func()
print("============")
return wrap
def print_text():
print("Hello world!")
decorated = decor(print_text)
decorated()
going to do some shopping bbl
!e
def decor(func):
def wrap():
print("============")
func()
print("============")
return wrap
def print_text():
print("Hello world!")
decorated = decor(print_text)
decorated()
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | ============
002 | Hello world!
003 | ============
What is the role of wrap here?
So wrap is the functionality or other things you're wanting to do to the decorated function
!e
def decor(func):
print("============")
func()
print("============")
def print_text():
print("Hello world!")
decorated = decor(print_text)
decorated()
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
001 | ============
002 | Hello world!
003 | ============
004 | Traceback (most recent call last):
005 | File "/home/main.py", line 9, in <module>
006 | decorated()
007 | TypeError: 'NoneType' object is not callable
The point of the other version (the function within a function), is that you're returning a function
I would like to know the reason for the error. I see the output here in 2nd code but the error is added
like the game Rust?
What is "NoneType object is not callable?"
So note the difference between the two decor functions:
def decor(func):
def wrap():
print("============")
func()
print("============")
return wrap
def decor(func):
print("============")
func()
print("============")
it means you were trying to basically do None()
Yep
When you don't have an explicit return in a function, you're returning None
A function/method always has to return something
!e
def decor(func):
print("============")
func()
print("============")
return 0
def print_text():
print("Hello world!")
decorated = decor(print_text)
decorated()
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
001 | ============
002 | Hello world!
003 | ============
004 | Traceback (most recent call last):
005 | File "/home/main.py", line 10, in <module>
006 | decorated()
007 | TypeError: 'int' object is not callable
!e
def decor(func):
print("============")
func()
print("============")
return 1
def print_text():
print("Hello world!")
decorated = decor(print_text)
decorated()
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
001 | ============
002 | Hello world!
003 | ============
004 | Traceback (most recent call last):
005 | File "/home/main.py", line 10, in <module>
006 | decorated()
007 | TypeError: 'int' object is not callable
🥲
So things like integers can't be "called"
So, we use wrap to return wrap?
Yep, we return a new function
decorated ends up being wrap
But still called decorated
Means we return everything present inside the function?
Like func, information present inside print
..etc.
Yep yep
It's a prepackaged, new function
Kind of like an object from a class. All that functionality is bundled into the new function
The benefit is that we can add functionality or consistency on a function
Got it!
!e
def is_even(x):
if x == 0:
return True
else:
return is_odd(x-1)
def is_odd(x):
return not is_even(x)
print(is_odd(17))
print(is_even(23))
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | False
What's the use of doing like this? What's the difference will it make if I simply put if x%2==0: return 'Even' etc.?
There really isn't a point in this case
i think a good for an
Bye @somber heath
IT guy to have a Aws certification
bye @rugged root
Yeah, AWS is interesting!
EC2 Instances, Load balancer.. etc.
All the devops stuff scares me
I am not into devops, i am into data science only! Looking for people who can help me in SQL
Via voice chat discussions
Good good
Edith Piaf is the shit.
Haven't heard of vsPY before
Okay, NORMALLY there aren't streams in here....
This ah...
Yeah
you don't need global current_color, colors
Maybe have colors as COLORS just to show it's not changing
you are not reassigning what current_color refers to
yep, you're modifying current_color not reassigning
What is this from??
Conan
I've said it before. I like bees.
well my english is to littler in order to express what ever i want to express
TempleOS
Yeah that's what I heard
Walking from his car
King Julian- I like to move it (with Lyrics)
King Julian- I like to move it (Madagascar Version with Lyrics)
👋
gaming in linux very horrible
that vine app is horrible too
oh true the steam app for linux is there
which is suppose to make gaming in linux much more easy
If more people used Linux, more devs would target it.
So if we want Linux games, we've got to use Linux.
Or, perhaps more the point, to not use Mac or Windows.
But to each their own.
Except user experience sucks
I don't disagree.
i will keep using linux for hacking mean while i wait for the good gaming in linux
It’s not going to happen but Linux desktops need all Linux UI devs to pick a single distro and stick to it.
the rabbit hole regedit vocabulary
I’m over Windows server
Apparently doors are really hard to get right 😄
i good project might be to do a windows game emulador for linux
Already exists, Proton
i will try it much more later
google lost a lot of money
but still have the same amount of client
the lost money because all the unsucefull projects they made
plus the made google map for free
@rugged root got a min for some selenium help 🙂
Please share maybe I can help too. BTW I am a Scraping & Automation Engineer. HEre is my linkedin and Github
https://www.linkedin.com/in/seemab-yamin
https://github.com/granY69/
lol
👋🏼
Hi
!e
class A:
def method(self):
print(1)
class B(A):
def method(self):
print(2)
B().method()
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
2
Intersting! So, we can even define classes without __ init __
!e ```py
class A:
def init(self):
print("Hello, world.")
class B(A):
pass
B()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.
!e
print(dir(object))
@craggy breach :white_check_mark: Your 3.11 eval job has completed with return code 0.
['__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
!e ```py
class A:
pass
A()```
@somber heath :warning: Your 3.11 eval job has completed with return code 0.
[No output]
!e ```py
class A:
pass
print(A.mro())```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
[<class '__main__.A'>, <class 'object'>]
class A:
def __init__(self,n):
print(self.n)
def method(self):
print(1)
class B(A):
def method(self):
print(2)
B(5).method()
!e
class Sus(type):
def __init__(self, *args, **kwargs)
del self.__init__
class A(metaclass=Sus):
pass
A()
@craggy breach :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | class A:
004 | File "/home/main.py", line 2, in A
005 | del A.__init__
006 | ^
007 | NameError: name 'A' is not defined
welp
!e
class A:
def __init__(self,n):
self.n=n
def method(self):
print(1)
class B(A):
def method(self):
print(2)
B(5).method()
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
2
!e
class A:
def __init__(self,n):
print(self.n)
def method(self):
print(1)
class B(A):
def method(self):
print(2)
B(5).method()
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 11, in <module>
003 | B(5).method()
004 | ^^^^
005 | File "/home/main.py", line 3, in __init__
006 | print(self.n)
007 | ^^^^^^
008 | AttributeError: 'B' object has no attribute 'n'
What's the issue?
what it says
!e
class A:
def __init__(self,n):
self.n=n
def method(self):
print(self.n)
class B(A):
def method(self):
print(2)
B(5).method()
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
2
!e
class A:
def __init__(self,n):
self.n=n
def method(self):
print(self.n)
class B(A):
pass
B(5).method()
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
5
Got it
So, we need to initialise value using self.value=value first and then we can use it to print right?
Cool
class Shape:
def __init__(self, w, h):
self.width = w
self.height = h
def area(self):
print(self.width*self.height)
class Rectangle(Shape):
def perimeter(self):
print(2*(self.width+self.height))
#your code goes here
w = int(input())
h = int(input())
r = Rectangle(w, h)
r.area()
r.perimeter()
How does Rectangle class know about self.width and self.height?
Cuz it inherits from Shape that gives it those attributes upon initialization
I see
you sure?
Metairie man rigs flash bang to deter car burglars
Subscribe to WDSU on YouTube now for more: http://bit.ly/1n00vnY
Get more New Orleans news: http://www.wdsu.com
Like us: http://www.facebook.com/wdsutv
Follow us: http://twitter.com/wdsu
Instagram: https://www.instagram.com/wdsu6/
and there's this ...
(12 Dec 1998) English/Nat
VOICED BY: Louise Bates
With car-jackings increasingly common in South Africa, one inventor has created the ultimate deterrent - a flame-thrower.
When it's fitted to the side of a car, the 'blaster' system send out jets of fire to stop any would-be hijackers in their tracks.
VOICE-OVER:
0005: The heat is...
a local guy from my home town ... https://youtu.be/watKJpSMS6s
This Electrician from Wolverhampton rigged his van with 1000v to stop tool thieves.
Previously he has had over £5000 worth of tools stolen so he took things into his own hands!
Remember to like, comment and subscribe!
Check out our top 10 videos here https://bit.ly/3y65crl
Facebook - https://bit.ly/3y1GgkS
TikTok - https://bit.ly/33zNSNy
Tw...
!e
class Shape:
def __init__(self, w, h):
self.width = w
self.height = h
def area(self):
print(self.width*self.height)
class Rectangle(Shape):
def __init__(self,w,h):
super().__init__(w,h)
def perimeter(self):
print(2*(self.width+self.height))
#your code goes here
w = int(input())
h = int(input())
r = Rectangle(w, h)
r.area()
r.perimeter()
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
:warning: Note: input is not supported by the bot :warning:
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 18, in <module>
003 | w = int(input())
004 | ^^^^^^^
005 | EOFError: EOF when reading a line
Can't do inputs in the eval
Gotta use hard coded values
(specifically for the one here)
!e
class Shape:
def __init__(self, w, h):
self.width = w
self.height = h
def area(self):
print(self.width*self.height)
class Rectangle(Shape):
def __init__(self,w,h):
super().__init__(w,h)
def perimeter(self):
print(2*(self.width+self.height))
#your code goes here
w = 10
h = 8
r = Rectangle(w, h)
r.area()
r.perimeter()
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 80
002 | 36
12v Smoke Screen system for integration with alarm system in commercial vans, cash in transit vehicles, boats, caravans etc. Find out more here: http://www.smokemachines.net/buy-12v-security-smoke-machine.shtml
Hnnnngggggg. I want to code something, but I can't really work on the Mahjong thing while I'm at work
Hard to justify gaming looking windows
Mahjong thing?
Riichi Mahjong
ah
4 player game
I'm looking for a chinese competition rules mahjong multiplayer game
It'd be done in Godot
Which is the problem at the moment, I do most of my coding at work
Harder to justify coding when I'm doing it in a game engine
use pygame-ce
@jaunty lintel 143564484970151936
Whoop, sorry random person
!stream 143564484970151936
✅ @upbeat leaf can now stream until <t:1678724608:f>.
@somber heath are you here?
I am.
CAD Sketcher is a free and open-source project looking to enhance precision and parametric workflows in blender by bringing CAD like tools, features and usability to blender.
can i dm you?
SQL query?
how when your defining a function can you format a variable with no value into it but you cant when its just a normal string
i know its probably pretty basic but im struggling on the logic behind it
I'm not quite following what you mean. Are you meaning having a default value?
def my_function(user_string=""):
...
Something like that?
Links:
- The Asianometry Newsletter: https://asianometry.substack.com
- Patreon: https://www.patreon.com/Asianometry
- Twitter: https://twitter.com/asianometry
doesnt a variable have to have a value in order to print
Blender tutorial series showing you how to use the most common features, like modelling, lighting, materials, geometry nodes and rendering - whilst making a donut.
Download the Blender Shortcut Hotkey PDF: https://www.dropbox.com/s/jg4fs4i8zw5bxt7/Blender 3.0 Shortcuts v1.2.pdf?dl=0
Google Doc version: https://docs.google.com/document/d/1...
Dr. Alex Filippenko (University of California, Berkeley)
Mar. 8, 2023
We have a new supersensitive eye in the cosmic sky. Parked nearly one million miles from Earth, the James Webb Space Telescope (JWST) is 100 times more sensitive than the Hubble Space Telescope. JWST observes at the red to the mid-infrared parts of the spectrum, offering new i...
Can you show what they have?
amd and intel might start a fight for the faster cpu in 2024
Ah yeah. That'll fail if they don't pass anything
It'll complain about expecting an argument and not getting one
def hello(greeting = ""):
is that just defining the varaible in the function
or adding value
however you say it
@knotty dock if greeting is not provided it will use "" as the default string
def hello_func(greeting):
return "hello" + '{} Function.'.format(greeting)
print(hello_func('HI'))
1 and 20 respectively? haha
Presumably.
ie def hello_func(greeting):
return "hello" + '{} Function.'.format(greeting)
print(hello_func('HI'))
why like that?
also f strings 🙄
i just tryed to return a string so it does not give an error
Knife fraud. I never thought I'd see the day.
yes
im lost on that
return "hello{} Function".format(greeting)
wow the bot prevention on this is pretty solid
Hmm?
the easy way to reset the greeting function is making greeting = to none, like def hellofunc(greeting = ""):
print(hello_func('HI'))
how is it printing hi when there is no value for greeting?
thats what i dont get
def hello_func(greeting):
''.format(greeting)
return greeting
print(hello_func('HI'))
this might work
instead of passing ("hi")
this code works
@upbeat leaf Can you try turning Krisp back on?
def hello_func(greeting):
"".format(greeting)
return greeting
print(hello_func("HI"))
We're getting breathing noise now
i think im just being stupid
what does that do?
ahhhhhhh
so if i need to replicate it later on i wont be able to
@paper karma welcome 🙂
.format(greeting) do make the variable greeting to none
i guess
but it is a function that return greeting
just use f strings
return f"{greeting} function."
thanks man 😄
😉
I'm trying to remember where to go for this google email verification thing for self hosted emails lol
so when you put an unknown variable into a function and return it . it gives it value
@grand plover
when you use the return the variable next to the return will be returned, the return can return a variable or an array
you can only uses the return with a function
so in this code what does the .format(greeting)
do
thank you for helping btw
i forgot to say
that code should return the "hello"
and the greeting should be ignore
on that code
so is it kind of pointless to put the .format(greeting)
yes
it should give a error because the variable is empty
thats what im saying but it doesnt
but then the code will reset the variable
to none
and the return will return none
what does format do?
i thought it put whatever was in the bracket into the {}
so yes greeting will go to the {}
it is call interpolation
can some one else help gilzene
i am noob
and because it has no value is that why hi will go in place of the {}
what's the issue exactly?
idek at this point ngl
Start from the beginning
okay.
The original thing posed was:
def hello_func(greeting):
return "{} Function".format(greeting)
print(hello_func("Hi"))
Or something like that, right?
In some cases
!e
def hello_func(greeting="Yo"):
return "{} Function".format(greeting)
print(hello_func("Hi"))
print(hello_func())
It won't work in the case of no argument
Now, you can MAKE it work by adding a default
!e
def hello_func(greeting="Yo"):
return "{} Function".format(greeting)
print(hello_func("Hi"))
print(hello_func())
@rugged root :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Hi Function
002 | Yo Function
In this case, that's what "Yo" is
This means that if there are no arguments passed, it'll just use the "Yo" instead
okay
This helps us prevent errors about not passing enough arguments
Now, that can also be an empty string
alright nice nice
just one thing
how does the .format() part work
It works in a couple different ways. The most basic way is that it will look for any {} curly braces, and fill those slots with the arguments passed to .format(), in this case greeting
As an example:
thats what confuses me
!e
ham = "pork"
eggs = "spam"
print("I love {} and {}".format(ham, eggs))
@rugged root :white_check_mark: Your 3.11 eval job has completed with return code 0.
I love pork and spam
yes
this
this makes sense
Now, we can do another thing with it
this is why im confused
Honestly this is why I just prefer f-strings
you had to give the variable value before you could put it in format()
!e
ham = "pork"
eggs = "spam"
print(f"I love {ham} and {eggs}")
@rugged root :white_check_mark: Your 3.11 eval job has completed with return code 0.
I love pork and spam
so how is it just allowing it in ef hello_func(greeting):
return "{} Function".format(greeting)
Same result, much clearer as to what goes where
So before the value is actually returned, .format() executes
THEN the new string, the one where you put the new values in, is passed out of the function
return has the lower priority
So it'll only actually return the value once everything on the right has resolved itself
@lucid blade I may jump down to cloud for a bit
yh im lost mate its alright i dont want to waste anymore of anyones time
.
Right
you didnt need to preset greeting to anything
but for this
you put ham= 'pork'
i dont get how
appaerently the format pass the greeting to the {}
!e Let me rework that:
def breakfast(meat, other_meat):
return f"I love {meat} and {other_meat}"
print(breakfast("ham", "bacon"))
@rugged root :white_check_mark: Your 3.11 eval job has completed with return code 0.
I love ham and bacon
yh
So when you pass something as an argument (in this case "ham" and "bacon"), those values get caught by the parameters of the function definition (in this case meat and other_meat)
That's kind of equivalent to meat = "ham" and other_meat = "bacon"
this makes alot of sense
thats what i was confused about
Sometimes you just need it explained in just the right way
very carefully
breakfast('Hemlock', 'his dad jokes') 👀
❤️
I identify myself as a crab hidden beneath human skin behind a computer
"Whelp, I can only use two of these fingers at a time. Curse you hidden claws!!!"
X3
Dude my hands are really shaky
damn, is that a recent thing?
I remember my vietnam vet buddy, we'd go shooting together, he had the shakiest hands tho. still had pretty good aim tho
wtf
heya @lucid blade
🙂
what's the prob CoTangent?
What's your question
im making a game
where
its just like space shooter
exept planes and shit
i got all the movement and spawning of enemies however i cant make either shoot bulletes
im using pygame btw
idk how to actually ask you guys the question cause idk what wrong with my code
alr
^ there's code for projectiles in there somewhere
Oh good, my headset is borked
Shoot, whatcha got
yaaay
its not to important as i understand it now
Oh fair enough
but it why can you not put
alr thanks bro
' ' --- into the breakfast(meat, other_meat)
So as in
def breakfast(meat, other_meat):
return f"I love {meat} and {other_meat}"
print(breakfast(meat, other_meat))
truuuuuuue, all banks are sketchy
yh like wa
h
what is the rule that doesnt allow you to replace the meat and other meat with ''
' '
they both mean nothinh
!e So you could do:
ham = "pork"
eggs = "spam"
meat = "bacon"
other_meat = "chicken"
def breakfast(meat, other_meat):
return f"I love {meat} and {other_meat}"
print(breakfast(ham, eggs))
print(breakfast(meat, other_meat))
@rugged root :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | I love pork and spam
002 | I love bacon and chicken
eggs could be considered a future meat, yeah
Well played
ah alright
So this goes into something called "scope"
There are technically two separate sets of meat and other_meat
There is the one that's outside the function (often called the global scope), and the one in the function.
We'll look back at this example as reference:
ham = "pork"
eggs = "spam"
def breakfast(meat, other_meat):
return f"I love {meat} and {other_meat}"
print(breakfast(ham, eggs))
So when we pass the arguments into the function, they're caught by the parameters. meat = ham and other_meat = eggs, right?
yh
!e But what if we try to reuse meat and other_meat outside of the function?
ham = "pork"
eggs = "spam"
def breakfast(meat, other_meat):
return f"I love {meat} and {other_meat}"
print(breakfast(ham, eggs))
print(meat, other_meat)
@rugged root :x: Your 3.11 eval job has completed with return code 1.
001 | I love pork and spam
002 | Traceback (most recent call last):
003 | File "/home/main.py", line 8, in <module>
004 | print(meat, other_meat)
005 | ^^^^
006 | NameError: name 'meat' is not defined
We can't do that. meat and other_meat only exist within the scope of the function
Once the function is done, they get thrown away
Now we can see that we can use the same names as those outside the function (which is called shadowing), but the actual variables from inside that function are gone
ok that makes sense
or something like that
or more like while l == pork
is it like the l
as its temporary
and only exists inside
maybe im not making sense
Yeah not fully following
In Python, if statements and the loops (for and while) do not have their own scope
So for i in range(5):, i will still exist after the for-loop completes
oh okay
That isn't necessarily the case for all languages, but in Python, those variables stick around
HOWEVER
so i couldnt use i after
@rugged root :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 0
002 | 1
003 |
004 | 1
Did the middle print just to make space
You can use i after it, but it's typically not recommended to do so
Happy to help
Actually I wonder if that behavior is in the Python specification or if it's just an implementation detail...
Just me musing, sorry
also list comps and gens have their own scope, which causes some trouble sometimes (mentioning cuz it's basically a for loop)
whats an implementation detail
So the Python interpreter that we normally use (the one you get from python.org) is known as CPython
It's written using the C language, hence the name. It's from the Python Software Foundation, it's their standard example of how you can implement the language.
Now, there are other implementations in other languages, although none are as fleshed out or commonly used as CPython
little bit dumber pleas
what does implementation mean
lmao
is it the same thing in real life as it is in code
Things like Jython (Python interpreter written in Java) and IronPython (Python interpreter written in C#)
Both of those have poor support
True
what would you recommend to do to get better
But it's just examples of what I mean
Hmm
Going over some of the resources if you haven't already
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
And just futz around, look into things that catch your interest, try them, break them, try them again
Ask questions
especially the part where everything's an object, it kinda goes way deeper than most people expect I think
True
okay nice nice @rugged root you should be a teacher irl
better than any of the ones i had
Maybe someday, who knows
@floral anvil Sorry, only just saw your message. Check out the #voice-verification channel. That'll tell you what you need to know about the voice gate
K Tq
Discovery of CRISPR and its function 1993 - 2005 — Francisco Mojica, University of Alicante, Spain
DNA is an emerging storage medium for digital data but its adoption is hampered by limitations of phosphoramidite chemistry, which was developed for single-base accuracy required for biological functionality. Here, we establish a de novo enzymatic DNA synthesis strategy designed from the bottom-up for information storage. We harness a template-i...
@mild quartz doesn't RNA actually have a higher density than DNA?
why?
(or, at least, in forms it occurs in naturally because of less redundancy (single-stranded instead of double-stranded))
- Thymine is larger than Uracil
(is DNA just better packed than RNA even despite that?)
forms being submitted are usually post requests
@slim edge don't paste multi-line scripts into REPL
if you want a hacky solution, there is one
what are you using for input?
input()?
Yes exactly input()
so, if you want your program to take multi-line input, you need some way to tell it where it ends
for example, you can end the input when you have "\n\n"
or on EOF
depending on the usecase
how long did it take to get you to this level of knowledge about python
When pasting the multi-line text into the console then it jumps over to the next input() without possibility to add "\n\n"
like
input something: ABC
[add more text or press enter to confirm]
: DEF
:
your input:
ABC
DEF
you always need some sort of separator so your program would be able to tell where your input ends
If i have
ABC
DEF
In my clipboard, then pasting that into the python-console, it's going to jump over the next input()
with input() you can't separate newline in the input from pressing enter
Okey, what is the preferred function?
you mean that ABC and DEF fall into separate inputs, right?
you can do sth like
lst = []
while True:
user_input = input()
if user_input == "end":
break
lst.append(user_input)
result = "\n".join(lst)
print(result)
to get multiline input
user has to type end and press enter to exit
Yes they fall into different input's
I just want to paste this multi-line string into the first input()
assume that your inputs are coming from a file
ABC
DEF
TUV
XYZ
where does the first input end and the second input start?
This won't work, the first line of the clipboard goes into user_input, but then the rest is thrown away
So I want to copy all of this files information into the clipboard, then paste it into the first input()
did you try it out?
The second input() i can add any kind of word to
so you want it to be impossible to write multi-line input without pasting it, right?
No I haven't, it's just that it's the same problem, that giving a multi-line paste to an input only saves the first line of the paste
I made that example specifically for multi line text input
sample input here:
ABC
DEF
end
TUV
XYZ
end
hi guys someone can help me in a python issue?
sure
hi
yeah so
i ahve this problem when i try to install a module idk if the module does'nt existe at all if yes can you help me replace the code to be functional
sure it's not called colorplus?
idk can u confirm?
sus, https://libraries.io/pypi/colourplus wut is this
it's not on pypi
so uhh, yeah, you can't install it like that, mby you have a wheel for it?
no
I think you're looking for this https://pypi.org/project/pyfiglet/0.7/
oh probably to be honest im not a dev i just simply trying to find help on this problem that i struggle on for 1 week
but we can't make screenshare this could be useful to be efficent
mhm, yeah, just do pip install pyfiglet
and the module will probs be named sth different but yeah
the code is here
what's the format to send it like a .txt?
but in color on this channel?
you can use a pasting service for that
I'm not sure what code you want to show tho, since the issue is that you don't have a module in your environment
Hey @lament barn!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
I'm not sure what to do with it
it's a checker that check some numbers
Thank you for clarifying, I assumed that Python worked differently than it does
It works!
hello
what's poppin' bud?
!e
class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def calculate_area(self):
return self.width * self.height
@classmethod
def new_square(cls, side_length):
return cls(side_length, side_length)
square = Rectangle.new_square(5)
print(square.calculate_area())
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
25
What is this class method?🥲
Based on what I see, we are trying to just add new values in place of width and height by using class method which is helping it to calculate area for other shapes. Is my understanding correct?
I didn't understand cls and why do we return cls?
cuz it's Rectangle
Are we returning a class?😮
cls inside that method is Rectangle, you can literally replace it with Rectangle when returning, same thing
mby
!e
class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def calculate_area(self):
return self.width * self.height
@classmethod
def new_square(Rectangle, side_length):
return Rectangle(side_length, side_length)
square = Rectangle.new_square(5)
print(square.calculate_area())
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
25
okay, not quite what I meant
cuz now it's no different at all
!e
class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def calculate_area(self):
return self.width * self.height
@classmethod
def new_square(cls, side_length):
print(cls is Rectangle)
return Rectangle(side_length, side_length)
square = Rectangle.new_square(5)
print(square.calculate_area())
@craggy breach :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | 25
Wow
So, this classmethod above is doing this job right?
i mean '''@classmethod'''
yeah
Cool
!e
class Pizza:
def __init__(self, toppings):
self.toppings = toppings
@staticmethod
def validate_topping(topping):
if topping == "pineapple":
raise ValueError("No pineapples!")
else:
return True
ingredients = ["cheese", "onions", "spam"]
if all(Pizza.validate_topping(i) for i in ingredients):
pizza = Pizza(ingredients)
@scenic quiver :warning: Your 3.11 eval job has completed with return code 0.
[No output]
!e
class Pizza:
def __init__(self, toppings):
self.toppings = toppings
def validate_topping(self):
if self.toppings == "pineapple":
raise ValueError("No pineapples!")
else:
return True
ingredients = ["cheese", "onions", "spam"]
if all(Pizza.validate_topping(i) for i in ingredients):
pizza = Pizza(ingredients)
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 12, in <module>
003 | if all(Pizza.validate_topping(i) for i in ingredients):
004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
005 | File "/home/main.py", line 12, in <genexpr>
006 | if all(Pizza.validate_topping(i) for i in ingredients):
007 | ^^^^^^^^^^^^^^^^^^^^^^^^^
008 | File "/home/main.py", line 6, in validate_topping
009 | if self.toppings == "pineapple":
010 | ^^^^^^^^^^^^^
011 | AttributeError: 'str' object has no attribute 'toppings'
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/opidepiral.txt?noredirect
@staticmethod
def valudate_topping(topping):
if topping == "pineapple":
raise ValueError("No pineapples!")
else:
return True``````py
def valudate_topping(self, topping):
if topping == "pineapple":
raise ValueError("No pineapples!")
else:
return True```
class MyClass:
pass```
class MyClass:
pass
MyClass()```
class MyClass:
pass
instance = MyClass()```
!e ```py
class MyClass:
def greet(self):
print('Hello, world.')
instance = MyClass()
instance.greet()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.
instance.greet()
is the same as
MyClass.greet(instance)
sometimes helps
sry
I mean, you were gonna say that anyways, so I sort of interrupted your flow mby, idk
!e ```py
class MyClass:
def whoami(self):
print(self)
a = MyClass()
b = MyClass()
a.whoami()
b.whoami()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <__main__.MyClass object at 0x7f0c1fe38410>
002 | <__main__.MyClass object at 0x7f0c1fe38450>
So, you are creating 2 instances a and b which are objects and using them to call the methods. Object is calling the method and not the class in the above example right?
Is and equals?
I cannot hear anything
!e py a = [] b = [] c = a print(a == b) #True. a refers to an empty list. b refers to an empty list. print(a is b) #False. a refers to a different object than b refers to. print(a is c) #True. a refers to the same object that c refers to.
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | False
003 | True
!e ```py
class MyClass:
def is_self(self, value):
print(self is value)
a = MyClass()
b = MyClass()
a.is_self(a) #The a in the parentheses is given as value. The a left of the . is given as self.
a.is_self(b) #The b in the parentheses is given as value. The a left of the . is given as self.```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | False
MyClass.is_self(a, a)
MyClass.is_self(a, b)```Essentially, but we don't write it this way.
!e ```py
class MyClass:
def function_or_method(self):
pass
instance = MyClass()
a = type(MyClass.function_or_method)
b = type(instance.function_or_method)
print(a)
print(b)```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <class 'function'>
002 | <class 'method'>
When using classes, we generally want to be calling the method of an instance of a class, not the function of the class.
!e
class Pizza:
def __init__(self, toppings):
self.toppings = toppings
@staticmethod
def validate_topping(topping):
if topping == "pineapple":
raise ValueError("No pineapples!")
else:
return True
ingredients = ["cheese", "onions", "spam"]
if all(Pizza.validate_topping(i) for i in ingredients):
pizza = Pizza(ingredients)
@scenic quiver :warning: Your 3.11 eval job has completed with return code 0.
[No output]
!e ```py
class MyClass:
@staticmethod
def static_method():
print('Hello, world.')
instance = MyClass()
instance.static_method()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.
!e ```py
class MyClass:
def static_method():
print('Hello, world.')
instance = MyClass()
instance.static_method()```
@somber heath :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 7, in <module>
003 | instance.static_method()
004 | TypeError: MyClass.static_method() takes 0 positional arguments but 1 was given
!e ```py
class MyClass:
def static_method(self):
print('Hello, world.')
instance = MyClass()
instance.static_method()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.
No longer a static method, though.
class MyClass:
def method(_):
print("Hello, world.")```
!e
class Pizza:
def __init__(self, toppings):
self.toppings = toppings
def validate_topping(self,t):
self.t=t
if self.t == "pineapple":
raise ValueError("No pineapples!")
else:
return True
ingredients = ["cheese", "onions", "spam"]
if all(Pizza.validate_topping(i) for i in ingredients):
pizza = Pizza(ingredients)
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 8
002 | if self.t == "pineapple":
003 | IndentationError: unexpected indent
class MyClass: #Creating a class
pass
instance = MyClass() #Creating an instance (object created from the blueprint that is the class) and assigning a variable to it.```Instantiation.
!e
def __init__(self, toppings):
self.toppings = toppings
def validate_topping(self,t):
self.t=t
if self.t == "pineapple":
raise ValueError("No pineapples!")
else:
return True
ingredients = ["cheese", "onions", "spam"]
if all(Pizza.validate_topping(i) for i in ingredients):
pizza = Pizza(ingredients)```
@warped raft :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 1
002 | def __init__(self, toppings):
003 | IndentationError: unexpected indent
Finally, I wanted to actually get this! Got it now
!e
class Pizza:
def __init__(self, toppings):
self.toppings = toppings
def validate_topping(self):
if self.toppings == "pineapple":
raise ValueError("No pineapples!")
else:
return True
ingredients = ["cheese", "onions", "spam"]
if all(Pizza(i).validate_topping() for i in ingredients):
pizza = Pizza(ingredients)
@scenic quiver :warning: Your 3.11 eval job has completed with return code 0.
[No output]
No.
Yes.
You have to believe
Covid is dead
We are free
@somber heath tell me one country
!e
class Pizza:
def __init__(self, toppings):
self.toppings = toppings
def validate_topping(self):
if self.toppings == "pineapple":
raise ValueError("No pineapples!")
else:
return True
ingredients = ["cheese", "onions", "spam","pineapple"]
if all(Pizza(i).validate_topping() for i in ingredients):
pizza = Pizza(ingredients)
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 14, in <module>
003 | if all(Pizza(i).validate_topping() for i in ingredients):
004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
005 | File "/home/main.py", line 14, in <genexpr>
006 | if all(Pizza(i).validate_topping() for i in ingredients):
007 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
008 | File "/home/main.py", line 9, in validate_topping
009 | raise ValueError("No pineapples!")
010 | ValueError: No pineapples!
@somber heath Pardon me.
I got it! Thanks for the explanation opalmist.
@somber heath Covid is dead to me
All things are passed away
behold all things are become new
@somber heath can u hear me?
!voice @stark coral
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@leaden comet Hi
@brittle silo👋
@craggy breach Can you see this?
@somber heath Did I do something wrong?
yep, ty
as i could understand i need to wait for 3 days anyway
Hi
@vale quartz👋
Are you really ignoring me?
Okay, so. Property decorator.
!e
class Pizza:
def __init__(self, toppings):
self.toppings = toppings
self._pineapple_allowed = False
@property
def pineapple_allowed(self):
return self._pineapple_allowed
pizza = Pizza(["cheese", "tomato"])
print(pizza.pineapple_allowed)
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
False
Hiii sorry i dont have permission to talk
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
alright thx
!e
print
@brittle silo :warning: Your 3.11 eval job has completed with return code 0.
[No output]
!e ```py
class MyClass:
def init(self):
self._v = 10
@property
def value(self):
print('Getter')
return self._v
@value.setter
def value(self, v):
print('Setter')
self._v = v
instance = MyClass()
print(instance.value)
instance.value = 20
print(instance.value)```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Getter
002 | 10
003 | Setter
004 | Getter
005 | 20
!e
class Color:
def init(self, red:float, green:float, blue:float):
@brittle silo :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 2
002 | def __init__(self, red:float, green:float, blue:float):
003 | IndentationError: expected an indented block after function definition on line 2
!e ```py
class MyClass:
def init(self):
self.value = 10
instance = MyClass()
print(instance.value)
instance.value = 20
print(instance.value)```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 10
002 | 20
!e
class ColorValueError(Exception):
def init(self, message='< Maximum -> 255, Minimum -> 0 >'):
self.message = message
super().init(self.message)
class Color:
def init(self,red:float, green:float, blue:float) -> float:
if(red > 255 or green > 255 or blue > 255):
raise ColorValueError
if(red < 0 or green < 0 or blue < 0):
raise ColorValueError
a = Color(255,255,255)
@brittle silo :warning: Your 3.11 eval job has completed with return code 0.
[No output]
!e
class ColorValueError(Exception):
def init(self, message='< Maximum -> 255, Minimum -> 0 >'):
self.message = message
super().init(self.message)
class Color:
def init(self,red:float, green:float, blue:float) -> float:
if(red > 255 or green > 255 or blue > 255):
raise ColorValueError
if(red < 0 or green < 0 or blue < 0):
raise ColorValueError
a = Color(255,255,255)
print(a)
@brittle silo :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 12, in <module>
003 | a = Color(255,255,255)
004 | ^^^^^^^^^^^^^^^^^^
005 | TypeError: Color() takes no arguments
!e
class ColorValueError(Exception):
def init(self, message='< Maximum -> 255, Minimum -> 0 >'):
self.message = message
super().init(self.message)
class Color:
def init(self,red:float, green:float, blue:float) -> float:
if(red > 255 or green > 255 or blue > 255):
raise ColorValueError
if(red < 0 or green < 0 or blue < 0):
raise ColorValueError
def get_info(color:Color):
return color.red, color.green, color.blue
a = Color(255,255,255)
print(get_info(a))
@brittle silo :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 16, in <module>
003 | a = Color(255,255,255)
004 | ^^^^^^^^^^^^^^^^^^
005 | TypeError: Color() takes no arguments
!e
class ColorValueError(Exception):
def init(self, message='< Maximum -> 255, Minimum -> 0 >'):
self.message = message
super().init(self.message)
class Color:
def init(self,red:float, green:float, blue:float) -> float:
if(red > 255 or green > 255 or blue > 255):
raise ColorValueError
if(red < 0 or green < 0 or blue < 0):
raise ColorValueError
def get_info(color:Color):
return print(color.red, color.green, color.blue)
a = Color(255,255,255)
print(get_info(a))
@brittle silo :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 16, in <module>
003 | a = Color(255,255,255)
004 | ^^^^^^^^^^^^^^^^^^
005 | TypeError: Color() takes no arguments
!e
class ColorValueError(Exception):
def init(self, message='< Maximum -> 255, Minimum -> 0 >'):
self.message = message
super().init(self.message)
class Color:
def init(self,red:float, green:float, blue:float) -> float:
if(red > 255 or green > 255 or blue > 255):
raise ColorValueError
if(red < 0 or green < 0 or blue < 0):
raise ColorValueError
def get_info(color:Color):
return print(color.red, color.green, color.blue)
a = Color(255,255,255)
print(get_info(a))
@brittle silo :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 17, in <module>
003 | print(get_info(a))
004 | ^^^^^^^^^^^
005 | File "/home/main.py", line 14, in get_info
006 | return print(color.red, color.green, color.blue)
007 | ^^^^^^^^^
008 | AttributeError: 'Color' object has no attribute 'red'
!e ```py
class MyClass:
def init(self, a, b, c):
self.a = a
self.b = b
self.c = c
instance = MyClass(1, 2, 3)```
@somber heath :warning: Your 3.11 eval job has completed with return code 0.
[No output]
!e
class ColorValueError(Exception):
def init(self, message='< Maximum -> 255, Minimum -> 0 >'):
self.message = message
super().init(self.message)
class Color:
def init(self,red:float, green:float, blue:float) -> float:
self.r = red
self.g = green
self.b = blue
if(red > 255 or green > 255 or blue > 255):
raise ColorValueError
if(red < 0 or green < 0 or blue < 0):
raise ColorValueError
def get_info(self):
return print(self.r, self.g, self.b)
a = Color(255,255,255)
print(get_info(a))
@brittle silo :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 19, in <module>
003 | print(get_info(a))
004 | ^^^^^^^^
005 | NameError: name 'get_info' is not defined
!code
!e ```py
class MyClass:
def init(self):
self._v = 10
def value(self):
print('Getter')
return self._v
@value.setter
def value(self, v):
print('Setter')
self._v = v
instance = MyClass()
print(instance.value())
instance.value = 20
print(instance.value())```
@scenic quiver :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | class MyClass:
004 | File "/home/main.py", line 9, in MyClass
005 | @value.setter
006 | ^^^^^^^^^^^^
007 | AttributeError: 'function' object has no attribute 'setter'
!e ```py
print('Hello, world.')
print('Goodbye.')
``` @brittle silo
!e
class ColorValueError(Exception):
def init(self, message='< Maximum -> 255, Minimum -> 0 >'):
self.message = message
super().init(self.message)
class Color:
def init(self,red:float, green:float, blue:float) -> float:
self.r = red
self.g = green
self.b = blue
if(red > 255 or green > 255 or blue > 255):
raise ColorValueError
if(red < 0 or green < 0 or blue < 0):
raise ColorValueError
def get_info(self):
return self.r, self.g, self.b
a = Color(255,255,255)
print(Color.get_info(a))
@brittle silo :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 18, in <module>
003 | a = Color(255,255,255)
004 | ^^^^^^^^^^^^^^^^^^
005 | TypeError: Color() takes no arguments
!e ```py
class MyClass:
def init(self):
self._v = 10
def value(self):
print('Getter')
return self._v
instance = MyClass()
print(instance.value())
@scenic quiver :warning: Your 3.11 eval job has completed with return code 0.
[No output]
!e
class MyClass:
def __init__(self):
self._v = 10
def value(self):
print('Getter')
return self._v
instance = MyClass()
print(instance.value())
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Getter
002 | 10
!e
class ColorValueError(Exception):
def init(self, message='< Maximum -> 255, Minimum -> 0 >'):
self.message = message
super().init(self.message)
class Color:
def init(self,red:float, green:float, blue:float) -> float:
self.r = red
self.g = green
self.b = blue
if(red > 255 or green > 255 or blue > 255):
raise ColorValueError
if(red < 0 or green < 0 or blue < 0):
raise ColorValueError
def get_info(color:Color):
return color.r, color.g, color.b
a = Color(255,255,255)
b = Color.get_info(a)
print(b)
@brittle silo :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 6, in <module>
003 | class Color:
004 | File "/home/main.py", line 15, in Color
005 | def get_info(color:Color):
006 | ^^^^^
007 | NameError: name 'Color' is not defined
@brittle silo If you're going to post a bunch of code, could you please use the Discord codeblock markdown?
oke
Thanking you.
!e ```py
class MyClass:
def init(self, value):
self._var = value
@property
def var(self):
return self._var
@var.setter
def var(self, value):
self._var = value
@var.deleter
def var(self):
self._var = 0
instance = MyClass(5)
print(instance.var)
del instance.var
print(instance.var)``` @scenic quiver
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 5
002 | 0
If you ever wanted to use it.
Personally, I think it's janky, but eh.
@torn marsh👋
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
.topic
todays hell in py.noobs life.. different pandas series canceling out each other... doh
hey
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
I'm new to coding ,,, would love to get some guidance from you regarding the same
exact roadmap regarding solidity
it is used to build smart contracts on blockchain
but nvm
tell me more about python if you can pls
!e ```py
class A:
pass
class B(A):
pass
b = B()
print(isinstance(b, B))
print(isinstance(b, A))```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | True
LOL not rly
one sec
Solidity is an object-oriented programming language for implementing smart contracts on various blockchain platforms, most notably, Ethereum. It was developed by Christian Reitwiessner, Alex Beregszaszi, and several former Ethereum core contributors. Programs in Solidity run on Ethereum Virtual Machine.
but nvm tell me more about python if you can pls
like an exact guide or roadmap towards python
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Corey Schafer's Youtube, playlists.
thanks a bunch
.topic
.topic
Hey Maro. Hey Fury. Also, heya Kimchi.
I know how to tie my own shoelaces.
So many shoelaces.
Seriously. I've lost count.
@strange jolt👋
The master suppression techniques is a framework articulated in 1945 by the Norwegian psychologist and philosopher Ingjald Nissen. These techniques identified by Nissen are ways to indirectly suppress and humiliate opponents. In the late 1970s, the framework was popularized by Norwegian social psychologist Berit Ås, who reduced Nissen's original...
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
In the history of artificial intelligence, an AI winter is a period of reduced funding and interest in artificial intelligence research. The term was coined by analogy to the idea of a nuclear winter. The field has experienced several hype cycles, followed by disappointment and criticism, followed by funding cuts, followed by renewed interest ye...
https://youtu.be/GBtfwa-Fexc @rugged root
We put chatbot ChatGPT to the test with some physics questions.
More links and info below ↓ ↓ ↓
Featuring Professor Philip Moriarty... His blog on this topic can be found at: https://muircheartblog.wpcomstaging.com/2023/01/23/chatgpt-transforming-physics-education/
ChatGPT: https://chat.openai.com/auth/login
More videos with Professor Mori...
@somber heath
there's also ChatGPT playing chess
!voiceverify
Gotta do that command in #voice-verification
Barefoot running...sounds okay until you get stuck in the foot with something.
PS D:\JOB\BENbot> & C:/Users/User/AppData/Local/Microsoft/WindowsApps/python3.10.exe d:/JOB/BENbot/app.py
Traceback (most recent call last):
File "d:\JOB\BENbot\app.py", line 2, in <module>
from discord_slash import SlashCommand
ModuleNotFoundError: No module named 'discord_slash'
PS D:\JOB\BENbot>
Hey @little citrus!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
pip install -U discord-py-slash-command
py -m pip install -U discord-py-slash-command
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
quit()
py -3.10 -m pip install -U discord-py-slash-command
Hmm, yeah I think they changed it
Yeah, they swapped it
py -m pip uninstall discord-py-slash-command
yo 🙂
old discord.py?
new discord.py includes slash commands and interactions
without any extra stuff
both require at least discord.py 2.0
@little citrus what discord.py version are you using, again?
it's better to use storage that's built for backups, journaling and synchronisation
Nextcloud has some of that
(and it has CLI interface)
there was a breaking change in voice API recently
What as the change?
👁️ ➡️ 🏋️♂️, 👋
☮️
I think we've identified the issue in JDA. It seems like the UDP discovery changed the response from 70 to 74 bytes. You have to send and receive 74 bytes instead of 70.
https://github.com/Rapptz/discord.py/issues/9277#issuecomment-1450472138
Summary initial_connection method coroutine never returns resulting in failing to connect to a VC Reproduction Steps Call and await connect() on an instance of VoiceChannel. Details on getting an i...
Matthew Walker is Professor of Neuroscience and Psychology at the University of California, Berkeley, and Founder and Director of the Center for Human Sleep Science. Check out his book "Why We Sleep: Unlocking the Power of Sleep and Dreams" on Amazon. https://www.amazon.com/dp/1501144316
Garfield Minus Garfield.
!e py text = '''Apple Pear Orange Guava''' result = text.split('\n') print(result)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
['Apple', 'Pear', 'Orange', 'Guava']
if you drop it, you get a space split
!stream 559903350024568833
✅ @verbal zenith can now stream until <t:1678807416:f>.
!d str.split
str.split(sep=None, maxsplit=- 1)```
Return a list of the words in the string, using *sep* as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits are done (thus, the list will have at most `maxsplit+1` elements). If *maxsplit* is not specified or `-1`, then there is no limit on the number of splits (all possible splits are made).
If *sep* is given, consecutive delimiters are not grouped together and are deemed to delimit empty strings (for example, `'1,,2'.split(',')` returns `['1', '', '2']`). The *sep* argument may consist of multiple characters (for example, `'1<>2<>3'.split('<>')` returns `['1', '2', '3']`). Splitting an empty string with a specified separator returns `['']`.
For example:
!d str.splitlines
str.splitlines(keepends=False)```
Return a list of the lines in the string, breaking at line boundaries. Line breaks are not included in the resulting list unless *keepends* is given and true.
This method splits on the following line boundaries. In particular, the boundaries are a superset of [universal newlines](https://docs.python.org/3/glossary.html#term-universal-newlines)...
Huh. 3.2.
I should try to force myself to use it more.
Who was asking about splitting up a string?
void
Because you might do things differently if you were reading this string in from a file.
Text file objects are iterable.
It can save you from reading the whole file into memory at a time.
and more than just calling a different method, it does also do the assignment
!e ```py
print(10.0 // 2)
print(10 // 2.0)
print(10 // 2)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 5.0
002 | 5.0
003 | 5
@rugged root https://youtu.be/jvwfDdgg93E
Speaker: Matt Bachmann
Standard unit tests have developers test specific inputs and outputs. This works, but often what breaks code are the cases we did not think about. Property based testing has developers define properties of output and has the computer explore the possible inputs to verify these properties. This talk will introduce property...
Neat
!d functools.total_ordering
@functools.total_ordering```
Given a class defining one or more rich comparison ordering methods, this class decorator supplies the rest. This simplifies the effort involved in specifying all of the possible rich comparison operations:
The class must define one of `__lt__()`, `__le__()`, `__gt__()`, or `__ge__()`. In addition, the class should supply an `__eq__()` method.
For example:
@verbal zenith
this is fine to auto-fill those methods in some cases
!d slice
class slice(stop)``````py
class slice(start, stop, step=1)```
Return a [slice](https://docs.python.org/3/glossary.html#term-slice) object representing the set of indices specified by `range(start, stop, step)`. The *start* and *step* arguments default to `None`. Slice objects have read-only data attributes `start`, `stop`, and `step` which merely return the argument values (or their default). They have no other explicit functionality; however, they are used by NumPy and other third-party packages. Slice objects are also generated when extended indexing syntax is used. For example: `a[start:stop:step]` or `a[start:stop, i]`. See [`itertools.islice()`](https://docs.python.org/3/library/itertools.html#itertools.islice "itertools.islice") for an alternate version that returns an iterator.
!e py text = 'abcdefghijklmnop' print(text[5:])
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
fghijklmnop
A being worse than B doesn't mean B isn't bad
i want to make a program to maintain my battery live between 20 - 80%
but i want to keep my laptop plugged in but not charge
so i want to know if i can keep my laptop plugged in but not charge
That would be very hardware-specific as to if that would be a possibility at all. I would expect that you wouldn't be able to govern the charging like that.
What's the model of laptop?
i have a macbook so i was hoping i could do it software side
macbook is very harsh with hardware stuff
If Apple doesn't give you a way to do it in the OS, you're probably SOL.
@severe vigilHm. I am seeing options for it being listed.
With macOS Big Sur or later, your Mac can learn from your charging habits to improve the lifespan of your battery.
oh, thats interesting. ill just toggle that on
thanks very much 🙂
Mandalorian in a Karen wig.
hello
does anyone know why i get a type error for this def agedif(solidarty):
if not 0 <= solidarty <= 20:
return 'invalid number'
else:
return'solidarty'
that code doesnt work
wdym?
?
TypeError: '<=' not supported between instances of 'int' and 'str'
i get a type error
solidarity is a string value
wdym?
try if not 0 <= int(solidarity) <= 20:
For clarity, you could cast solidarity to int prior to doing the ternary expression.
yo
how did you know this was right?
and why does it work
because the error message told me, also follow Opal's advice
a <= b <= c```a is less than or equal to b AND b is less than or equal to c.
!e py 5 <= '123'
@somber heath :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | 5 <= '123'
004 | TypeError: '<=' not supported between instances of 'int' and 'str'
i dont understand?
is it user input?
with def
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.
if not 0 <= int(solidarty) <= 20:
return 'invalid number'
else:
return solidarty```
thats it
What calls this function?
Also, you shouldn't mix your return types unless it makes semantic sense to.
If you give your function something your function knows is wrong, you can raise an exception.
You'd then deal with that exception outside of the function.
You can worry about that later.
How are you creating solidarty?
Initially.
with the def
i dont understand your question
how i am creating it is in the code above
thats my knowledge of functions in on code
The object that you give to the call of agedif.
The argument.
How are you creating the argument?
ah
yh
youre right
that was the problem
thank you
how did you know?
what made you know that was the problem
was it cause thats the only thing it could of been
Experience. Once you solve enough of the same sort of problem, you get to learn how to walk back from where the problem happened to the origin of the problem.
Also the error messages are usually pretty specific about what and why happened, learning to read those would help you a lot
yh im just not used to it being as black and white as that
i thought it was a problem in the making of the function because of where the error was
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
import subprocess
subprocess.Popen("pause", shell=True)
print("hi")
yo i was reading back and didnt reall understand what you meant by this
are you saying i didnt need to use else
!e ```py
def func(value):
int(value) #Let's say func expects value to always be an int.
try:
func('abc')
except ValueError:
print('Caught')```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Caught
This is just an example, and there are times when you'd use try/except within the function.
But if the function semantically should always have value as an int, then it might make sense to handle the exception outside of the function.
!e py things = [1, 'abc', 5.5, 5+2j] for thing in things: try: print(int(thing)) except (ValueError, TypeError): pass #Let's ignore ValueErrors and TypeErrors
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 1
002 | 5
Yeah, you don't have to worry about this straight away.
only know if , else, elif
alright kl kl thank you
pass is what you write when you don't want to write anything but you have to because it expects you to
!e ```py
def func():
print('Hello, world.')```
@somber heath :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 3
002 | print('Hello, world.')
003 | ^
004 | IndentationError: expected an indented block after function definition on line 1
!e ```py
def func():
pass
print('Hello, world.')```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.