#voice-chat-text-0
1 messages · Page 105 of 1
second is generator comprehension
x is an element
a is an iterable
f is a ||predicate|| function
Pascal -- in 2006-2009 and 2015-2017
there's no "since"
I'm not coming back to it
@cedar solar this
this doesn't entirely count
because I wasn't really understanding what I was doing back then
I had C and Lua experience prior to 2017
@whole bear you used float
wdym
example:
expected: 46
got : 46.0
didn't put parentheses properly
i thought that isnt a thing you can do
!d operator.floordiv
operator.floordiv(a, b)``````py
operator.__floordiv__(a, b)```
Return `a // b`.
!e
print(999 // 10)
print(1000 // 10)
print(1001 // 10)
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 99
002 | 100
003 | 100
you had:
int(a + b) * 0.5
you probably meant:
int((a + b) * 0.5)
the more correct way:
round((a + b) * 0.5)
fun fact: it's also a median
!e
from statistics import median, mean
print(round(median([12, 30])))
print(round(mean([12, 30])))
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 21
002 | 21
math.mean
this is just a preset:
import sys
import math
you can use most of standard library
math shouldn't have it
def string_to_ascii(file_path:str):
result = []
buffer = []
with open(file_path, 'r') as file:
for char in file.read():
buffer.append(ord(char))
if len(buffer) == 3:
result.append(buffer)
buffer = []
if 0 < len(buffer) < 3:
for i in range(3 - len(buffer)):
buffer.append(0)
result.append(buffer)
return result
"waiting for bytes to base64"
because the following is something I use at least weekly:
>>> from os import urandom as u
>>> from base64 import b64encode as b
>>> b(u(32))
b'aFWbWO72JVO1T+1oCy6SkXB/aJtXFH0t1bNJ7awdZWw='
btw, urandom is cryptographically secure
I don't want to come up with variable names
- most one line solutions are more performant
and simpler
and more functional
I was talking to some telecom idiots
they are intercepting HTTP traffic and they're too stupid to confess they do it
!d chr
chr(i)```
Return the string representing a character whose Unicode code point is the integer *i*. For example, `chr(97)` returns the string `'a'`, while `chr(8364)` returns the string `'€'`. This is the inverse of [`ord()`](https://docs.python.org/3/library/functions.html#ord "ord").
The valid range for the argument is from 0 through 1,114,111 (0x10FFFF in base 16). [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError "ValueError") will be raised if *i* is outside that range.
they literally redirect to their site on 403/404
this is so moronic and illegal
and they reply with "OoH jUsT uSe HtTpS"
and what if the site doesn't have it?
!e
print(*range(10), sep=':')
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
0:1:2:3:4:5:6:7:8:9
!e ```py
dna = "ATCGCCA"
Write an answer using print
To debug: print("Debug messages...", file=sys.stderr, flush=True)
print(map({'A':'T','G':'C','T':'A','C':'G'}.getitem,dna),sep='')
it timed out
!e ```py
dna = "ATCGCCA"
Write an answer using print
To debug: print("Debug messages...", file=sys.stderr, flush=True)
print(map({'A':'T','G':'C','T':'A','C':'G'}.getitem,dna),sep=''
((to re-run you need to edit within a certain time window from the last edit))
!e ```py
dna = "ATCGCCA"
Write an answer using print
To debug: print("Debug messages...", file=sys.stderr, flush=True)
print(map({'A':'T','G':'C','T':'A','C':'G'}.getitem,dna),sep='')
@winter plover :white_check_mark: Your 3.11 eval job has completed with return code 0.
<map object at 0x7fe9d2cfd2d0>
!e
dna = "ATCGCCA"
print(*map({'A':'T','G':'C','T':'A','C':'G'}.__getitem__, dna), sep='')
print(*({'A':'T','G':'C','T':'A','C':'G'}.__getitem__(c) for c in dna), sep='')
print(*({'A':'T','G':'C','T':'A','C':'G'}[c] for c in dna), sep='')
print(''.join({'A':'T','G':'C','T':'A','C':'G'}[c] for c in dna))
print(''.join([{'A':'T','G':'C','T':'A','C':'G'}[c] for c in dna]))
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | TAGCGGT
002 | TAGCGGT
003 | TAGCGGT
004 | TAGCGGT
005 | TAGCGGT
* just uses __iter__
like for loop
!e
class C:
def __iter__(self):
yield 1
yield 11
print(*C())
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
1 11
!e
def f(*args):
print(f'{args!r}')
f(1, 11)
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
(1, 11)
@verbal zenith :white_check_mark: Your 3.11 eval job has completed with return code 0.
3
*args passing to a function is common in decorators
!e
def f(a,b):
print(a+b)
args = [1, 2]
f(*args)
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
3
!e
def f(a,b):
print(a+b)
x = (1,2)
f(*x)
@verbal zenith :white_check_mark: Your 3.11 eval job has completed with return code 0.
3
!e ```py
def f(*args):
print(f'{args}')
f(1, 11)
@winter plover :white_check_mark: Your 3.11 eval job has completed with return code 0.
(1, 11)
!e
a, b, *c = 1, 2, 3, 4, 5
print(f'{a!r} {b!r} {c!r}')
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
1 2 [3, 4, 5]
what is this ?!r?
!d f-string
String literals prefixed with 'f' or 'F' are commonly called “f-strings” which is short for formatted string literals. See also PEP 498.
!doc r
it's kind of formatting parameters but not really
!e
print("hello".__repr__())
hello = "hello"
print(f"{hello!r}")
@verbal zenith :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 'hello'
002 | 'hello'
!e
print(f'{"1" + "11"}')
print(f'{"1" + "11"!r}')
print(f'{"1" + "11"=}')
print(f'{"1" + "11"=!r}')
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 111
002 | '111'
003 | "1" + "11"='111'
004 | "1" + "11"='111'
ohno
!e
hello = "hi world!"
print(f"{hello=}")
@verbal zenith :white_check_mark: Your 3.11 eval job has completed with return code 0.
hello='hi world!'
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
"1" + "11"= '111'
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
"1" + "11"=_____'111'
!e
print(f'{"1" + "11"=!r:_^11}')
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
"1" + "11"=___'111'___
╭─────────────────────────────────────────────────────────────────────────────────
│ .\examples\rps.rat:4:131: Error: Invalid Binary numerical literal '12'
├────┬────────────────────────────────────────────────────────────────────────────
│ 0 │ print("Welcome to Rock, Paper, Scissors!"); print("Type 'rock', 'paper' ...
│ 1 │ // Rock, Paper, Scissors written in RattleScript
│ 2 │
│ 3 │ ... ', 'paper', or 'scissors' to play."); print("Type 'quit' to quit."0b12)
│ ├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌▲
| | Invalid Binary numerical literal '12'
│ 4 │
│ 5 │
╰────┴────────────────────────────────────────────────────────────────────────────
"Type 'quit' to quit."0b12
╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌~~~▲
python isn't slow necessarily
it just does a lot of stuff
if let Some((w, h)) = term_size::dimensions() {
println!("Width: {}\nHeight: {}", w, h);
} else {
println!("Unable to get term size :(")
}
Source code: Lib/curses
The curses module provides an interface to the curses library, the de-facto standard for portable advanced terminal handling.
While curses is most widely used in the Unix environment, versions are available for Windows, DOS, and possibly other systems as well. This extension module is designed to match the API of ncurses, an open-source curses library hosted on Linux and the BSD variants of Unix.
Note
Whenever the documentation mentions a character it can be specified as an integer, a one-character Unicode string or a one-byte byte string.
Whenever the documentation mentions a character string it can be specified as a Unicode string or a byte string.
I should re-do the interpreter of my language in Rust
most of the things it's doing are like:
[some_runtime_array[i] for i in some_compiler_array]
and also some tree rotations
Arc -- atomic
my first challenge solved on codewars was about implementing a mutex
(which had to use atomic functions)
atomic increment, for example, is guaranteed to increment the value
unlike ++i
which can run into a race condition
atomic -- not intersecting (in some sense)
"in exactly one step"
it's a CPU-level lock
probably
at pipelining layer
A gets i (10)
B gets i (10)
B writes ++i (11)
B gets i (11)
B writes ++i (12)
A writes ++i (11)
btw, C code isn't guaranteed to run in the order you wrote it
(which contributes to race condition issues)
A, B being threads
neither is it guaranteed to run in the same order on each call
there's some way to upload the ipynb
there are also inconsistencies between builds, between each process startup, etc.
first might result in +-10% performance change
or around that
what cell is causing the issue?
from the error, I guess
def get_number_of_jobs_T(technology):
#your code goes here
return technology, number_of_jobs
Yes
I couldn't even find the data related to what this question was asking:
Write a function to get the number of jobs for the Python technology.
I think api_url should be it
instead of what it is by default
the default is locally hosted
I have replaced the url with the link
wassup AF, Opal
Within that link there's no such wording "python technology" etc
hows that even possible
telecom people gave me 30% cash back for 3 months as an apology
its like saying building with gcc and compiling the builded image with llvm
yes
compiled code layout
maybe not as drastic as 10% for real applications but 1~3% for algorithms can be expected
https://youtu.be/r-TLSBdHe1A
Performance clearly matters to users. For example, the most common software update on the AppStore is "Bug fixes and performance enhancements." Now that Moore's Law has ended, programmers have to work hard to get high performance for their applications. But why is performance hard to deliver?
I will first explain why current approaches to evalu...
"Key Skills" field includes "Python" for some jobs
!e
code
!eval [python_version] <code, ...>
Can also use: e
Run Python code and get the results.
This command supports multiple lines of code, including formatted code blocks. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.
If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.
By default, your code is run on Python 3.11. A python_version arg of 3.10 can also be specified.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!
I got this number which might be incorrect
Can I see how you write the code above
In this one
the following is pretty much what you already had:
api_url = ...
def get_number_of_jobs_T(technology):
response = requests.get(api_url)
if not response.ok:
raise RuntimeError("something went wrong")
data = response.json()
... # write implementation here
return technology, number_of_jobs
and to use data, as it's a list, you'd probably use for loop
# initialise `number_of_jobs`
for job in data:
... # change `number_of_jobs` here
to get skills, it'd require job["Key Skills"] (as you found out earlier)
skills = job["Key Skills"]
if ...: # check if `skills` contains `technology`
... # change `number_of_jobs`
all in one place it'd be:
api_url = ...
def get_number_of_jobs_T(technology):
response = requests.get(api_url)
if not response.ok:
raise RuntimeError("something went wrong")
data = response.json()
number_of_jobs = 0
for job in data:
skills = job["Key Skills"]
if technology in skills:
number_of_jobs += 1
return technology, number_of_jobs
as you're counting the jobs that contain technology in corresponding Key Skills
@somber heath hello
@lone bluff 👋
the part I'm not sure about is if technology in skills:
Looks like I dont have the permission yet lol
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
How are you guys doing
it might be better to use
if technology in set(map(str.strip, skills)):
...
or
if technology in {skill.strip() for skill in skills}:
...
and if you want to do caseless comparison:
if technology.casefold() in {skill.strip().casefold() for skill in skills}:
...
Let me digest
bro dont eat your screen
I almost did...
But I think I got the logic burnt in my brain so thank you
@vocal basin
My fkin god...
oh, wow a new feature
@proper creek Your audio quality is poor the the point of being unintelligible.
I can also hear myself.
alr one sec
If you're downloading something, or someone on your internet connection is, that may also be the source of problems.
it sounds more like connection issues
which may explain why "on other vc" it could've worked better
wbt now
Still crap.
hello guys
just call me ilham @somber heath
it's kinda hard to spell it
ilham is my real name
i have a question
what is different between vscode and visual studio
also, turn off automatic gain control
it'd be simpler to list things that are similar:
brand
keybinds
@proper creek I just can't hear a thing you say when you say anything. It's next to pure garble.
i did
I'm not trying to be difficult. It's just awful to listen to.
should i do automatic input sensetivity
@somber heath how about pycharm pro and community?
I use neither.
That won't address the problem.
then what u use
why, pycharm is cool
IDLE. Because I'm a Luddite.
Visual Studio is a mostly proprietary product, mainly targeted at C#/C++ development
VS Code is a mostly open-source project, without specific language preference, with extensive plugin support
I'm not suggesting it's good, I'm just saying it's what I use.
the default one which comes with python?
The default one which comes with Python.
rlly
Visual Studio on its own is an IDE
VS Code without plugins is basically just a text editor
ohh for python wich is better?
between Visual Studio and VS Code, I'd choose VS Code
Visual Studio does have some support for python but it's not very beginner-friendly
not as much as Wing IDE or other simplistic products
whats different between pro and community edition?
(opinion, may change later)
ohhh thank you
Pycharm community is a free version of pycharm having limited feature where as pycharm professional is a pro version where you get some extra tools like database development , web development and some advance features.
for most usecases, none
pro has better support for data science, data bases, remote development, etc.
i just googled it up
thank you guys, it's help alot
* VS Code
whatever
PyCharm Pro is for cases when you can afford it
either you're a student and you get it for free
or you make enough money from it to pay for the license
anyone in here understand the computer vision ?
@midnight agate can hear
@coarse lily👋
@midnight agate i happy to join this server, cuz i not only learn about python but i can talk to peaple, especialy in english so i can practice my english too
meeting new person is kinda fun
@solar flax👋
hallow i went help to make game
Have you chosen a particular framework to use, or...?
can u guys give me some advice...
Regarding?
What sort of game are we talking?
Adventure game
Terminal-based? Graphics? 2D? 3D?
You may ignore my love, but not your health, don't forget to eat
:V
this is a task
Can you share the task text?
on computer vision?
yes
do you have a specific question?
or are you looking for a more general ("where do I go next"/"what should I remember") advice?
what is the best to filtering image using opencv to detect of the text ? especially the manga
kanji/hiragana OCR?
no text but task make game such as https://youtu.be/qYomF9p_SYM
Creating a Mario Maker style game in Python with a level editor, transitions, enemy behaviour, animations, menus and a player camera. It's a really chunky project.
If you want to support me: https://www.patreon.com/clearcode
(You also get lots of perks)
Social stuff:
Twitter - https://twitter.com/clear_coder
Discord - https://discord.com/inv...
Okay, so you're probably talking something along the lines of PyGame.
I remember someone recommending a specific program for that but I forgot what it was
I'm probably thinking about this one
https://github.com/sakarika/kanjitomo-ocr
can help me
ya..lot a people told me just use the OCR software like tesseract,EASYOCR
but that's not easy to filter the image that can recognize the text
so, what you're looking for is pre-processing to pick out only the text, right?
SWIFT?
I don't really use Pygame the way you're supposed to.
more paypal
paypal and other payment processors reduce payment time because they don't actually transfer money instantly
wbym
@somber heath what can i do
so how does it transfer?
it's like when you transfer inside a bank (to the client of the same bank):
bank doesn't need to pay anyone
if simplified, it just reduces the amount on one account and increases on another
https://www.youtube.com/watch?v=FfWpgLFMI7w I would suggest you start here.
Learn how to use Pygame to code games with Python. In this full tutorial course, you will learn Pygame by building a space invaders game. The course will help you understand the main game development concepts like moving characters, shooting bullets, and more.
💻 Code: https://github.com/attreyabhatt/Space-Invaders-Pygame
🎥 Course created by bu...
@coarse lily Unless, of course, you're new to Python. In which case...https://www.youtube.com/watch?v=YYXdXT2l-Gg&list=PL-osiE80TeTskrapNbzXhwoFUiLCjGgY7
In this Python Beginner Tutorial, we will start with the basics of how to install and setup Python for Mac and Windows. We will also take a look at the interactive prompt, as well as creating and running our first script. Let's get started.
Mac Install: 1:25
Windows Install: 5:44
Installs Complete: 8:37
Watch the full Python Beginner Series he...
so what happens when you transfer money through pay pal but the both use different bank
actual money transfer happens
- when you deposit/withdraw
- when paypal moves money from one of its accounts to another (those corporate accounts may be region-separated or in other ways requiring internal transfers)
thanks
where do i get more detail about how it works in detail
money transfer #1: you deposit to paypal from bank A
no real money transfer: you send money over paypal to someone else
money transfer #2: that some one else withdraws from paypal to bank B
"deposits" and "withdrawals" may be implicit
so, from formal money perspective,
you pay paypal, then paypal pays someone else
so why does some countries does not support pay pal
@fluid sluice👋
Hey @proper creek!
It looks like you tried to attach file type(s) that we do not allow (.rar). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
if you have too much money to spend and if you aren't afraid of Amazon, you can look into this:
https://docs.aws.amazon.com/textract/index.html
if you prefer open-source solutions, you can search online for other "text extraction" (seems to be the keyword here) alternatives
another example of what could potentially be related:
https://github.com/chrismattmann/tika-python
(I'm just looking through this right now)
https://github.com/topics/text-extraction
hey umm so does anyone know how to make a program which translates big numbers to word
like 1000000 = One Million
those are usually bundled with localisation software
localisation software?
"words" is a language-specific concept
some localisation-related settings/libraries (in PLs such as C#) include culture-specific display of numbers
"refactoring"?
@somber heathcan open any dask and make pygame
i downloaded this code
it should work via pip (without downloading the whole source)
https://github.com/savoirfairelinux/num2words#installation
@proper creekHave you used the modulus operator before or the divmod function?
idk what you are talking about
!d divmod
divmod(a, b)```
Take two (non-complex) numbers as arguments and return a pair of numbers consisting of their quotient and remainder when using integer division. With mixed operand types, the rules for binary arithmetic operators apply. For integers, the result is the same as `(a // b, a % b)`. For floating point numbers the result is `(q, a % b)`, where *q* is usually `math.floor(a / b)` but may be 1 less than that. In any case `q * b + a % b` is very close to *a*, if `a % b` is non-zero it has the same sign as *b*, and `0 <= abs(a % b) < abs(b)`.
nah
It's how you can start to decompose numbers.
wait ima try num2word
Separating them into constituent parts, mathematically.
If someone else has done a project for it, sure. You can use that.
@mental warren 👋
It takes time. Learn a little bit at a time. Don't treat yourself too harshly over the inability to grasp a concept.
With study and practice and eventual greater fluency with the language, you'll start to give yourself the tools to surmount the next obstacle.
@cobalt hawk@fickle nimbus👋
hey
Hey
i need some help with a program, but the problem is that i dont have the ability to speak
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
do you know about image processing
What sort are we talking?
Can you solve this real interview question? Longest Common Prefix - Write a function to find the longest common prefix string amongst an array of strings.
If there is no common prefix, return an empty string "".
Example 1:
Input: strs = ["flower","flow","flight"]
Output: "fl"
Example 2:
Input: strs = ["dog","racecar","car"]
Output: ""...
Could you spot the inefficiencies in the solution and provide a better and an efficient solution?
You could poke around #algos-and-data-structs.
This is pretty cool, in C you can often optimise the code by using inline assembly because the div instruction stores in the int div in rax and remainder in rdx in x86_64 asm
@quaint dew👋
int main(void) {
int a = 5;
int b = 2;
int x = (int)a / b;
int y = a % b;
return 0;
}
compiles to
main:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], 5
mov DWORD PTR [rbp-8], 2
mov eax, DWORD PTR [rbp-4]
cdq
idiv DWORD PTR [rbp-8]
mov DWORD PTR [rbp-12], eax
mov eax, DWORD PTR [rbp-4]
cdq
idiv DWORD PTR [rbp-8]
mov DWORD PTR [rbp-16], edx
mov eax, 0
pop rbp
ret
but you could rewrite this as
main:
push rbp
mov rbp, rsp
mov DWORD PTR [rbp-4], 5
mov DWORD PTR [rbp-8], 2
mov eax, DWORD PTR [rbp-4]
cdq
idiv DWORD PTR [rbp-8]
mov DWORD PTR [rbp-12], eax
mov DWORD PTR [rbp-16], edx
mov eax, 0
pop rbp
ret
eax and edx are the 32 bit versions of rax and rdx
Hi
honestly shaun got me through my GCSE's
He also got me through mine
what a legend
The IDEA OF CENTER OF GRAVITY plays an enormous role in the affairs of men. In this program we show a number of enchanting and dramatic DEMON¬STRATIONS bearing on the IDEA.
A - In the very first demonstration we show a double-track which serves as an inclined-plane. Things that can roll - when put at the top - should roll downhill. ...
@maiden bone👋
hello
thanks
I almost thought this was about the prefix function
these are so obscure on their own that they don't have separate Wikipedia algorithms
https://cp-algorithms.com/string/z-function.html
https://cp-algorithms.com/string/prefix-function.html
@terse needle I also use arduino
@terse mulch👋
so what are you doing
this syntax reminds me only of C
I can't remember anything else that uses {.field = value}
@cedar glacierYahoy. Your screen name pleases me.
@vocal basin i want to just see this arduino stuff for some time
can we do this after about 15 min
ok
thank you
@hasty jungle by saying "5 lights" you definitely missed the word "pedestrian"
@whole bear👋
@terse needle so when are you doing this in irl
@hasty jungle
two for pedestrians
three for cars
@hollow swallow👋
@terse needle can i see your code and join you
this makes sense
damn
@umbral cairn👋
@terse needle so have you tried sensor detection and stuff
also how to zoom in discord
Weird pedestrian logic: Zig zag randomly across oncoming traffic. She'll be right.
see you later
"Weird Al" Yankovic's new album "Mandatory Fun" out now on iTunes: http://smarturl.it/MandatoryFun
Amazon: http://smarturl.it/MandatoryFunAMZ
Google Play: http://smarturl.it/MandatoryFunGP
http://www.WeirdAl.com
Music video by "Weird Al" Yankovic performing Word Crimes. (C) 2014 RCA Records, a division of Sony Music Entertainment
Xperza
@green wave 👋
big bruddu is whatchin ya
@bronze matrix👋
any beginners here?
hi
I didn't intend to join. Felt it would be rude to just leave immediately though!
Fine. Bye!
hi agian sorry, m a little new to python but i want to learn "classes"
couldn't find where to start
yeah i can
oh thank u
that's better
!d str.upper
str.upper()```
Return a copy of the string with all the cased characters [4](https://docs.python.org/3/library/stdtypes.html#id15) converted to uppercase. Note that `s.upper().isupper()` might be `False` if `s` contains uncased characters or if the Unicode category of the resulting character(s) is not “Lu” (Letter, uppercase), but e.g. “Lt” (Letter, titlecase).
The uppercasing algorithm used is described in section 3.13 of the Unicode Standard.
!e py text = 'abc' print(text) print(text.upper())
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | abc
002 | ABC
class MyClass:
pass```
!e ```py
class MyClass:
def my_method(self):
print('Hello!')
my_instance = MyClass()
my_instance.my_method()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello!
is vs ==
nope all ik is ==
!e py a = [] b = [] c = a print(a == b) #True. a is pointing to an empty list. b is pointing to an empty list. They're equal. print(a is b) #False. a is pointing to one list. b is pointing to a different list. They're not the same list. print(c is a) #True. c is pointing to the same list than a is pointing to.
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | False
003 | True
can't u repeat sorry ?
@high swan👋
👋
yup now it's more clear
!e ```py
class MyClass:
def my_method(self, value):
print(value)
instance = MyClass()
instance.my_method('Hello, world.')```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.
IIRC there are some cases, esp. with object optimization (sys.refcount()) that influences == and is
!e ```py
class MyClass:
def my_method(self, value):
print(self is value)
a = MyClass()
b = MyClass()
a.my_method(a)
a.my_method(b)```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | False
for short strings and numbers
!e
b = 3
print(a == b)
print(a is b)
@high swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | True
and literals are, iirc, guaranteed to be cached
ohh okay thank u
!e ```py
class Person:
def init(self):
print('Hello, world.')
person = Person()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.
!e ```py
class MyClass:
def init(self, value):
print(value)
MyClass('Hello, world.')```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.
!e ```py
class Person:
def init(self, name):
self.name = name
def greet(self):
print(f'Hello. My name is {self.name}.')
alex = Person('Alex')
sally = Person('Sally')
alex.greet()
sally.greet()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Hello. My name is Alex.
002 | Hello. My name is Sally.
i understand, just something, the "init"isn't clear
ohh, that's better , can i have twoo init ?
hahaha true ture
!e ```py
class MyClass:
def add(self, value):
print(f'You tried to add {value}.')
return 9001
print(MyClass() + 'abc')```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | You tried to add abc.
002 | 9001
actually m trying to learn classes just for fun,
yeah, same, i noticed them while using Qtdesigner
Hello guys
How do I send message like this so it's proper?
sry, gtg 🫡
!code
Rust has a more strict separation for functions vs methods
(might be useful to look into it later, when you are very familiar with OOP and programming in general)
thank u @somber heath , i got to go
some ways to use interface-like concepts are forced to be functions there (unless you try really hard and use extension methods)
are there any dynamic programming languages which have extension methods "in their culture" except for JS?
I guess some other Lisp-ish and prototype-based do
` # List out the various categories in the column 'CompFreq'
df['CompFreq'].unique()
array(['Yearly', 'Monthly', 'Weekly', nan], dtype=object)
Create a new column named 'NormalizedAnnualCompensation'
Use the below logic to arrive at the values for the column NormalizedAnnualCompensation.
If the CompFreq is Yearly then use the exising value in CompTotal
If the CompFreq is Monthly then multiply the value in CompTotal with 12 (months in an year)
If the CompFreq is Weekly then multiply the value in CompTotal with 52 (weeks in an year) `
How do I populate the new column
can you create it just with null values at first?
(and then replace with correct values)
idk if pandas allows attaching properly initialised columns in one go
yes I can make an empty column
I'm thinking about multiple ifs statement for 'yearly', 'monthly' and 'weekly' with it's respective multiplication
And making a loop, would that work
or a dictionary
with, for a example, an entry monthly -> 12
@vocal basin i have question
so i try pycharm, did the python language that i downloaded before is not connected with pycharm?
i need to install the library again
nvm maybe i have wrong env that i chose
venvs by default don't inherit external packages
so, yes, you need to install in each project separately
the optimal way is to do it through settings
and there "plus" button
thank you so much for the information
!e
code
!eval [python_version] <code, ...>
Can also use: e
Run Python code and get the results.
This command supports multiple lines of code, including formatted code blocks. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.
If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.
By default, your code is run on Python 3.11. A python_version arg of 3.10 can also be specified.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!
!e wtf
@whole bear :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 | wtf
004 | NameError: name 'wtf' is not defined
!e print('hello world')
@whole bear :white_check_mark: Your 3.11 eval job has completed with return code 0.
hello world
!e import os
os.system('cd /var/www/html')
os.remove('index.html')
@whole bear :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 2
002 | os.system('cd /var/www/html')
003 | IndentationError: unexpected indent
@whole bear :white_check_mark: Your 3.11 eval job has completed with return code 0.
i love you Opal Mist
!e hello = 'hello'
world = 'world'
both = hello+wolrd
print('{},{}'.format(both))
why didnt work ?
:(
@somber heath what is wrong with my code ?
didn't run
!e hello = 'hello'
world = 'world'
both = hello+world
print('{},{}'.format(both))
@whole bear :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 2
002 | world = 'world'
003 | IndentationError: unexpected indent
!code
!e hello = 'hello'
world = 'world'
both = hello+world
print('{},{}'.format(both))
@whole bear :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 2
002 | world = 'world'
003 | IndentationError: unexpected indent
@whole bear :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 | import neuralintents
004 | ModuleNotFoundError: No module named 'neuralintents'
aw
thats nice
i have a discord bot
just put your mouse over the voice channel
then you'll see it
!e ```py
print('Hello, world.')
```
!e '''
@whole bear :x: Your 3.11 eval job has completed with return code 1.
001 | File "/home/main.py", line 1
002 | '''
003 | ^
004 | SyntaxError: unterminated triple-quoted string literal (detected at line 1)
@whole bear :warning: Your 3.11 eval job has completed with return code 0.
[No output]
!e ```py
hello = 'hello'
world = 'world'
both = hello+world
print('{},{}'.format(both))
@whole bear :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 4, in <module>
003 | print('{},{}'.format(both))
004 | ^^^^^^^^^^^^^^^^^^^^
005 | IndexError: Replacement index 1 out of range for positional args tuple
!e ```py
hello = 'hello'
world = 'world'
both = hello+world
print('{},{}'.format(hello,world))
@whole bear :white_check_mark: Your 3.11 eval job has completed with return code 0.
hello,world
!e hello = 'hello' world = 'world' both = hello+world print('{}'.format(both))
@thick basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
helloworld
^^
:D
@mighty spoke 👋
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
thanks @somber heath
russian roulette
!e ```py
import random
import os
if random.randint(0,6) == 1:
os.remove('C:/Windows/System32')
@whole bear :warning: Your 3.11 eval job has completed with return code 0.
[No output]
lol
i started coding in 2020 in lockdown and now i am studying software engineering which is wonderful
do you know kali linux ?
yes a little bit
is kalix purple good?
what computer you have?
Do you have any projects i can see @somber heath
local asian with no life skills goes camping (help)
you too
opal
im a noob coder
no
thats a youtube video title
do you speak japanese ?
what about chinese ?
oh
i know
KONNICHIHA
😳
you said konnichiha for me ?
😳
I don't remember if it's the same for the "wa" particle
(standalone word)
yes it is
watashi wa gei jiyanai
は -- sound "ha"
は -- marker "wa"
yes
there are nuances, as always
i skate
i can do a kickflip
shoveit
and ollie
varial kickflip
tre flip
i wanna do a skate bot
with python

the bot will be a professional skater
like tony hawk
@somber heath chat gpt is helping me
@final crane #media-processing message
@midnight agate test successful-ish
it sounds like packet loss, yes
"sounds" both figuratively and literally
also, Discord might be contributing to issues
I had problems uploading media
and seems like you're having some problems of that sort too
(given a duplicated image)
@solemn steeple 👋
although it was during the "processing" step
Ask. Let's find out if I'm able.
duplicated images also seem like discord doing idempotence ( https://en.wikipedia.org/wiki/Idempotence ) incorrectly
i installed an module whatsapp_api but it not working
... yes, I'm including the link only because of a stupid joke LP made
Can you tell us more about how you came to the conclusion it isn't working?
wit i send you that error
did you run pip install from inside the env?
can you send the link for whatsapp_api docs?
wait how can i do that ??
where did you get import whatsapp_api from?
at the top of the program
no.
I mean who told you to do that?
what article/blog/human?
from AI
but it showa wait
this is the power of AI
you're probably looking for this instead
https://github.com/danielcardeenas/whatsapp-framework
hmm
it's a little bit outdated
ohhh oki oki
DO NOT TRUST CHATGPT. 😁
ohh thanks
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
quite likely
hmm oki oki
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@somber heath @vocal basin thanks for help
check !user in #bot-commands to make sure you have enough messages
your previous messages may be counted
So that returns a context object
!d exec
exec(object, globals=None, locals=None, /, *, closure=None)```
This function supports dynamic execution of Python code. *object* must be either a string or a code object. If it is a string, the string is parsed as a suite of Python statements which is then executed (unless a syntax error occurs). [1](https://docs.python.org/3/library/functions.html#id2) If it is a code object, it is simply executed. In all cases, the code that’s executed is expected to be valid as file input (see the section [File input](https://docs.python.org/3/reference/toplevel_components.html#file-input) in the Reference Manual). Be aware that the [`nonlocal`](https://docs.python.org/3/reference/simple_stmts.html#nonlocal), [`yield`](https://docs.python.org/3/reference/simple_stmts.html#yield), and [`return`](https://docs.python.org/3/reference/simple_stmts.html#return) statements may not be used outside of function definitions even within the context of code passed to the [`exec()`](https://docs.python.org/3/library/functions.html#exec "exec") function. The return value is `None`.
@whole bear @whole bear 👋
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
as i see , we have to send about 50 messages
bah.. I wasnt paying attention and letting a piece of test code runnning while I was updating it... whoopsie.. mem maxed out and the whole thing is now unresponsive 😦
@loud eagle @floral anvil 👋
where should i sent 50 MESSAGES ?
👋
thanks.
hahaha thank you @somber heath . i believe i dont have permission to speak yet
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@inland flower 👋
python-general is in the count yeah ?
I didn't get a match! Please try again with a different search term.
!zen
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than right now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
Hey
beautiful
@peak zephyr 👋
Hi
hibopal
@gusty rover 👋
Hey
@somber heath👍
@somber heath
@chilly moat 👋
I have to send about 50 messages. Are you a robot? @somber heath
HI can u help me in publishing my HTML files online and i just started coding btw.
Does that answer your question?
hhh
i tried they arent helping
i used netlify but im not good at using <a href="...">
can i have prm to speak
i wanna share my screen
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
what is 3 10 min blocks
@somber heath
mk
can i dm u and vc from there if tthats possible?
mk
!voice
!voiceverify
@tropic ravine 👋
skadoosh
Thank you for your words of wisdom, Mr Black.
tell me o' @somber heath of the river your words of wisdom.
yes
@safe elbow 👋
👋
?
I like to give a wave to people who join voice chat who don't have their speaking privileges, so they know they can type text in this channel to participate in the voice conversations that way.
@strong fulcrum 👋
When I was younger, I used to worry I would get a dent on the top of my head from wearing headphones 😄
What're you working on Pynoob?
gtg 👋
@stuck furnace sadly working on fixing data exported from a horrible db, it is no neglected that its either breaking my scripts all together or missing data needed..
so ive been trying to patch ir update it where i can.
Hello Guys!!
m sorry but is the mouse cursor 'lagging' for me only or the same for you guys as well?
Morning guys
One simple question so I can move on with life. Functions with parenthesis vs without, why is that and any and reasoning behind?
For example
df.shape works without parentheses
df.Employment.mode() # Shows me the mode of Employment but df.Employment.mode returns all the employment method for all rows, before showing me the mode.
So why is that?
pyinstaller
Why are my data plots so different when I plot the timestamps on the x-axis. The other graph uses the index for the x-axis.
Here it worked out
@vocal basin hloo how can i use this
upper_bound = [df.describe().loc['75%','ConvertedComp'] - df.describe().loc['25%','ConvertedComp']] upb = [upper_bound*1.5]
When I tried to multiply I get an error can't multiply sequence by non-int of type 'float'
The value is inside 'upper bound' how do I multiply the value inside and not the list 'upper bound' itself
s = s[::-1]
output: ["o","l","l","e","h"]
s = s[0:5:-1]
Can you solve this real interview question? Reverse String - Write a function that reverses a string. The input string is given as an array of characters s.
You must do this by modifying the input array in-place [https://en.wikipedia.org/wiki/In-place_algorithm] with O(1) extra memory.
Example 1:
Input: s = ["h","e","l","l","o"]
Output: ["...
s[:]=s[::-1]
s = s[::-1]
left = 0
right = len(s) - 1
while left < right:
s[left], s[right] = s[right], s[left]
left += 1
right -= 1```
def is_power_of(number, base):
# Base case: when number is smaller than base.
if number < base:
# If number is equal to 1, it's a power (base**0).
return base**0
# Recursive case: keep dividing number by base.
return is_power_of(number, base)
print(is_power_of(8,2)) # Should be True
print(is_power_of(64,4)) # Should be True
print(is_power_of(70,10)) # Should be False
!e
code
!eval [python_version] <code, ...>
Can also use: e
Run Python code and get the results.
This command supports multiple lines of code, including formatted code blocks. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.
If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.
By default, your code is run on Python 3.11. A python_version arg of 3.10 can also be specified.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!
!e
def is_power_of(number, base):
# Base case: when number is smaller than base.
if number < base:
# If number is equal to 1, it's a power (base**0).
return base**0
# Recursive case: keep dividing number by base.
return is_power_of(number, base)
print(is_power_of(8,2)) # Should be True
print(is_power_of(64,4)) # Should be True
print(is_power_of(70,10)) # Should be False
@robust lichen :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 10, in <module>
003 | print(is_power_of(8,2)) # Should be True
004 | ^^^^^^^^^^^^^^^^
005 | File "/home/main.py", line 8, in is_power_of
006 | return is_power_of(number, base)
007 | ^^^^^^^^^^^^^^^^^^^^^^^^^
008 | File "/home/main.py", line 8, in is_power_of
009 | return is_power_of(number, base)
010 | ^^^^^^^^^^^^^^^^^^^^^^^^^
011 | File "/home/main.py", line 8, in is_power_of
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/yiwihoturo.txt?noredirect
@winter plover
@drifting pecan You can type text here. This being the associated text channel to the current voice chat.
ok brother
@somber heath im having issues understanding this recursion problem for some reason
Recursion is arse. Try using a stack.
def is_power_of(number, base):
# Base case: when number is smaller than base.
if number < base:
# If number is equal to 1, it's a power (base**0).
return __
# Recursive case: keep dividing number by base.
return is_power_of(__, ___)
print(is_power_of(8,2)) # Should be True
print(is_power_of(64,4)) # Should be True
print(is_power_of(70,10)) # Should be False``` Its like fill in the blanks but i dont understand what its asking
Oh.
first is true
I'm in brainless mode. I'll take a look later, but I can make no guarantees.
im guessing the return is .. is_power_of(number,base)
there was an off topic voice chat channel 1 year before. where it is now?
!e
code
!eval [python_version] <code, ...>
Can also use: e
Run Python code and get the results.
This command supports multiple lines of code, including formatted code blocks. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.
The starting working directory /home, is a writeable temporary file system. Files created, excluding names with leading underscores, will be uploaded in the response.
If multiple codeblocks are in a message, all of them will be joined and evaluated, ignoring the text outside them.
By default, your code is run on Python 3.11. A python_version arg of 3.10 can also be specified.
We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!
!e```py
def is_power_of(number, base):
if number <=1:
return number==1
if number%base==0:
return is_power_of(number//base,base)
print(is_power_of(8,2)) # Should be True
print(is_power_of(64,4)) # Should be True
print(is_power_of(70,10)) # Should be False
There was not.
This is the off-topic voice channel.
It is the on-topic voice channel.
It is all things and no things.
bruh
@somber heath ok brother
!e
def is_power_of(number, base):
if number <=1:
return number==1
if number%base==0:
return is_power_of(number//base,base)
print(is_power_of(8,2)) # Should be True
print(is_power_of(64,4)) # Should be True
print(is_power_of(70,10)) # Should be False
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | True
003 | None
screw recursion just bs
!e```py
def is_power_of(number, base):
if number ==1:
return True
elif number%base==0:
return is_power_of(number//base,base)
else:
return False
print(is_power_of(8,2)) # Should be True
print(is_power_of(64,4)) # Should be True
print(is_power_of(70,10)) # Should be False
@scenic quiver :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | True
003 | False
!e ```py
def is_power_of(number, base):
if number <=1:
return number==1
return is_power_of(number//base,base)
print(is_power_of(8,2)) # Should be True
print(is_power_of(64,4)) # Should be True
print(is_power_of(70,10)) # Should be False
@winter plover :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | True
003 | False
1st blank -- True
2nd blank -- (number/base, base)
dude this course im taking is lacking the explaining things and just gives the bare minimum
1st blank -- number == base
2nd blank same
@spiral sierra 👋
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
muted
@whole bear👋
I guess he did
so where do i need to send 50 messages
@somber heath
yeah this is kinda annoying
okay I'll send here
I'm guessing I'll be banned if I spam
okay let's chat using chat till I get verified
lol
it's the norm nowadays
on every server
I'm saying it happens all the time
yeah
so what bring you here
damn
yeah
Its never over
hmm like 40 more mesages to go
it's okay
how good is yours
opal?
lol
I need to
send
40 more
messages
yeah
tell them
yes
tell me more
yes
you want me to?
hmm never tried that one
over network
okay wait
sure
with open('insight.txt', 'r') as f:
line = f.readline()
modified_line = line[:2] + 'U' + line[3:]
with open('output_file.txt', 'w') as f_out:
f_out.write(modified_line)
@gray kraken👋
yeah I ttok it's help for function
hello
how do i get the permission to speak in this channel ?
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
yeah it is similar
thanks "now i know " XD
@weary shell👋
i can do it myself but would take time to search for function name to read file
Wassup!
no actually you can give the error and it'll fix it
and Ik how to do it, so I would be able to fix it
I know
Hey i would like to know your views on GSOC 2023 as in "How to approach large code bases and get involved with it and approaches to get selected as a mentee for the medium to hard difficulty projects "
yes
yes
i don't have as such good contributions in large code repos
yes like i didn't contributed like a feature in kafka like
yeah
I just skim through all the code and pin down what need to be changed.
i contributed like documenting and small bug in my friend repos and all that's it
@subtle quarry👋
like i have seen jenkins project idea which i can contribute but it is already got so many folked to get involved init by writing proposals and already reviewed
NO that's how I approach large code
usually we don't have to make too many changes
so i am asking like for easy tasks there are already so many folkes already wrote proposal for that's why i wanted to get involved with some medium level project which there is less comp
lots
depends on what I'm working on but, recently rust, typescript
yeah FTE
idk mabe you know better
I have seen interviews on those ppl and they are not sumone who is supernatural, maro
they have been presented to us as so
thanks
i meant like extra ordinary
or so
few of my frnds were intern and then got in...says it isnt that difficult to get in
nvmm
yeah so?
I mean I just started
lol wasn't it to modify 3rd character
it saved it to a different file that's why?
I verified but still can't speak
you have to be in community for 3 days (30 min in each day i think) are you?
maybe not
no I'm testing
I'm taking it's help but not entirely
wow
oh I"m in music
amazon music
yea
amazon music app?
not familiar , but sounds cool
okay
can i ask you a question ?
sure
now , you are developing something with python language ?
any framework like flask or django ?
Heyy
nope
it's different
it works
but idk looks similar to the one above and you said it's difficult
with open('insight.txt', 'r+') as f:
line = f.readline()
modified_line = line[:2] + 'U' + line[3:]
f.seek(0)
f.write(modified_line)
f.truncate()
ok . i understood that it is just pure python , but what exactly are you coding ?
and can i know that how long are you coding with python ?
It's on and off
I never use just python
@midnight agate it dosen't work?
yes
yeah
yeah it is
if the file doesn't exist
it would just write the first line
hmm
we can read rest of the lines line by line and save it to new file
with open('insight.txt', 'r+') as f:
lines = f.readlines()
lines[0] = lines[0][:2] + 'U' + lines[0][3:]
f.seek(0)
f.writelines(lines)
f.truncate()
this works
@midnight agate
what is being attempted?
Seek methods can take two arguments.
I need a docker image with vim pre-installed
wouldn't this work?
I will run this as root right now
"this is a threat"
How would you approach this if this were a physical sheet of paper?
I ran the wrong image
@left mesa👋
what is insight.txt supposed to look like?
to change exactly one byte, truncate/writelines is not needed
you're leaving opal?
to change exactly one character, it's more sane to re-open the file
what's your point that I shouldn't use chatgpt?