#off-topic-lounge-text
1 messages · Page 27 of 1
wait
so what does making an environment variable do
plus this thing happens
sometimes
even though i've installed tikinter before
See the Python 3 docs for PYTHONPATH.
The PYTHONPATH variable has a value that is a string with a list of directories that Python should add to the sys.path directory list. - from the previous link
try anconda
I need to send 50 message or the server will kill me
Buy a cheap copy of Lifespan: Why We Age—and Why We Don't... book by David A. Sinclair. A paradigm-shifting book from an acclaimed Harvard Medical School scientist and one of Time 's most influential people. It's a seemingly undeniable truth that aging... Free Shipping on all orders over $10.
hi
Hi! :wave:
HI :)
hello
started = False
while True:
command == input("> ").lower()
if command == "start":
if started:
print("car is already started...")
else:
started = True
print("car started")
elif command =="stop":
if not started:
print("car is already stopped...")
else:
started = False
print("Car stopped!")
elif command == "help":
print("""
Start - starts the car
Stop - Stops the car
Quit - to end game""")
elif command == "quit":
break
else:
print("Please input proper command...")```
command = ""
started = False
while True:
command == input("> ").lower()
if command == "start":
if started:
print("car is already started...")
else:
started = True
print("car started")
elif command =="stop":
if not started:
print("car is already stopped...")
else:
started = False
print("Car stopped!")
elif command == "help":
print("""
Start - starts the car
Stop - Stops the car
Quit - to end game""")
elif command == "quit":
break
else:
print("Please input proper command...")```
@unique skiff hey! do you need help?
Hello there, I have a quick newbie question, when I set VScode to use the python3 version 3.8.x without the virtual env it can find my modules just fine, like for example the module netmiko for network device automation and interaction, but if I switch the python3 version using the venv I have this error saying that it cannot import the module netmiko
I know this is something obvious but I am not familiar with python3 and virtual environments
Is this because I need to set some sort of path in the python3 venv ? that is already set in the system version?
I think I got the solution
I did a source blah blah venv name and activate, then while there, I installed the module netmiko
but I got this at the end:
Building wheel for future (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/jair/Documents/PYTHON3/venv1/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-iza1x_yz/future/setup.py'"'"'; __file__='"'"'/tmp/pip-install-iza1x_yz/future/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-i3puof3d
cwd: /tmp/pip-install-iza1x_yz/future/
Complete output (6 lines):
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
ERROR: Failed building wheel for future
Running setup.py clean for future
Failed to build future
Installing collected packages: pycparser, cffi, bcrypt, pynacl, cryptography, paramiko, scp, tenacity, pyserial, future, textfsm, ntc-templates, netmiko
Running setup.py install for future ... done
Successfully installed bcrypt-3.2.0 cffi-1.14.4 cryptography-3.3.1 future-0.18.2 netmiko-3.3.2 ntc-templates-1.6.0 paramiko-2.7.2 pycparser-2.20 pynacl-1.4.0 pyserial-3.5 scp-0.13.3 tenacity-6.3.1 textfsm-1.1.0
I wonder if it's OK to ignore
hey
laundmo it’s ok babe
https://github.com/pushshift/api hey laundmo, how about using this?
actually i just want to get some archived posts
like i want to scrape top comments on posts on r/RoastMe
IDK if anyone helped you, but try pip3 install wheel
Hi everyone
I am just trying to install python and VSCode to start learning python
and was wondering if anyone could help with the instruction of terminal
Thank you very much I will check that right now.
It should be pip3 install ... as I am using python3 only in my OS
Let me give it a try
I was not even aware of this source venv1/bin/activate where the name of my first venv is = venv1
that was the first thing I needed to do, which change my terminal to this > (venv1) jair@x1:~/Documents/PYTHON3$ which then make sense as I need to install all the modules I use for python3 in the venv that I used to use in my system itself. Again, this is the first time for me to use venv, everyone in YouTube or python3 courses recommend it.
@cold cipher I got this message > Requirement already satisfied: wheel in /usr/lib/python3/dist-packages (0.34.2)
@cold cipher perhaps it is some other deps...
Maybe setuptools
the missing command was bdist_wheel
ooh try it
bdist_wheel is installed with wheel
I thought
but I might be from setuptools
ahh Ok
let me check
however, I got this message in the end of the output:
Running setup.py install for future ... done
Successfully installed bcrypt-3.2.0 cffi-1.14.4 cryptography-3.3.1 future-0.18.2 netmiko-3.3.2 ntc-templates-1.6.0 paramiko-2.7.2 pycparser-2.20 pynacl-1.4.0 pyserial-3.5 scp-0.13.3 tenacity-6.3.1 textfsm-1.1.0```
That worked and in my venv1 the netmiko module works just fine
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (45.2.0)
@cold cipher anyway I can try to reproduce that error?
If I try to install another module?
or is there some sort of pip3 command I can use to check if there are any missing deps
If it doesn't autoinstall it then there is an issue in the module itself
They should all be in the install_requires=[...] statement in setup(...) in setup.py inside the module
But you might be right, I do have python2 in the Linux system itself but I don't use it
I see in the errors that it is referring to pip-blah blah no pip3
I can try installing with just pip and see
what do you think?
@cold cipher this worked > ```(venv1) jair@x1:~/Documents/PYTHON3$ pip install wheel
Collecting wheel
Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: wheel
Successfully installed wheel-0.36.2
Yay!
but again, how can I reproduce the error, perhaps if I install another module I might use in the future?
It shouldn't need wheel
I don't know why you got a source dist in the first place
not a compiled wheel
strange, that's for sure
For example I tried to install this new module:
Attempting uninstall: requests
Found existing installation: requests 2.22.0
Not uninstalling requests at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'requests'. No files were found to uninstall.
Successfully installed nornir-netbox-0.2.0 requests-2.25.1
but it looks like I am not getting that bunch of errors I was getting before
@cold cipher I think I am in good shaoe though, and I really appreciate your help on this
@crisp mantle Anytime ¯_(ツ)_/¯
intersting
in the uk it is a deep specialisation
here we do one thing and its ur job to be well rounded
i feel like the us government is too encroaching with their policy
we do too
evertyone does
whoops wrong chat i should be in voice chat
my bad
sorry
Anyone knows how to code a Discord bot that just stays 24/7 in a Speak Channel and doesn't quit even if I turn down my PC?
You'd have to have it hosted on a VPS, Raspberry Pi or on a computer you don't plan on ever turning off
The bot can only run so long as whatever it's hosted on is on
yo
yo
pyttsx3
Its not working in my PC
I installed the packaged too
But its generating error
Hey
Try running it through the terminal. Sometimes, that works better.
VScode
visual studio is by no means meant for python
@carmine current thank you so much.
i need help with lists
Go ahed @fluid stream
Nvm it’s been sorted
no, sorry
you need to get voice verified
there are requirements
the bot probably pinged you w/a link when you joined the vc no?
@lost finch #voice-verification should tell you what you need to know
need help @primal bison ?
a little
whats it about
class method
How can I do a really basic Web Crawler?
!code
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
ㅤ
wasssssssssssssssssssssssssssssup
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
i might spam a little here lmao
spamming is bad
yup
I have one doubt in python
is there anyone who can help
probably, move to a help channel
just talking about random topic is a good idea...
sup bro
hi
how u doing
great
yeah
hi
Peace exists only in VC 1
lol
!voiceverify
!voiceverify
def deleting(counter):
counter += 1
print(type(counter))
cursor.execute("DELETE FROM words WHERE rowid = {}".format(counter))
conn.commit()
it does not work! but why?
Hello all
!voiceverify
!voiceverify
!voiceverify only works in #voice-verification
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
@primal bison 
hmmm
!rule 5 @rocky peak
5. Do not provide or request help on projects that may break laws, breach terms of services, be considered malicious or inappropriate. Do not help with ongoing exams. Do not provide or request solutions for graded assignments, although general guidance is okay.
We will not assist with DDOS things like that. Period.
DDoS, the thing that was in your screenshot.
Not an acceptable topic for the server.
eso
era falso
era una broma para un server y todos comenzaron a decir que estaba haciendo un viruz y en realidad estaba praticando python
y comenze a buscar vainas de ddos
4. This is an English-speaking server, so please speak English to the best of your ability.
@rocky peak
ok thanks i'm wrong i was server and i will explain
Fine, just be more careful next time. @rocky peak
Jokes like that are taken incredibly seriously
sorry
nice
Help
i have an np array t = [3,2,4,2,4,NaN,NaN] and i have an array tisNaN = [False,False,False,False,False,True,True] (from np.isnan(t) and i want to delete the nan values out of t
how do i do it?
i found a solution
I am running python on a pi 4 and when i am testing some code in visual studio code and when i try to use random it is not working can anyone help
@ebon cargo
@ebon cargo skoc do VC
@ebon cargo kamo wtf ja nemuzu zapnout mikrofon lol
@peak latch je to potlačený
@ebon cargo cekej, hledam novy server s VC
If you are trying to partner on a GUI Project hmu
hello everyone, I would like to know if someone did any research or project?
expected identifier or '('
for(int i = 0; i <= 20; i++)
{
int[] numbers = new int[1, 2, 3, 4, 8];
int MyIndex = Random.Range(0, 4);
randomKodiya = numbers[MyIndex];
}
halp
no mic
sorry
wait
stop
we can talk
@wide aurora
we can talk
fuck
i just wanna
learn some python
why it no print
my hangman
hey bro
sorry my mic is not yet authorised
you need help?
imma try to quickly see if my voice is now verified
how am i still not verified tf
okay chief i really dont understand
queamer u need help?
my mic isn't authorized yet either
can someone help
with installing opencv on anaconda
command(pass_context=True)
async def pm(ctx, user: discord.User):
embed = discord.Embed(title="send", color=0x006eff)
await ctx.send(embed=embed)
for i in range(spam):
if stop != 0:
await user.send(f'{user.mention}' + " GAY!? AND DOSH")
else:
break
command()
async def stop(ctx):
stop = 0
print("STOP")
while(stop):
pass
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
GAY? AND DOSH :D
lol
game_is_on = True
apple = Actor("apple")
score = 0
def draw():
screen.clear()
apple.draw()
def place_apple():
apple.x = randint(10, 800)
apple.y = randint(10, 600)
place_apple()
def on_mouse_down(pos):
global score
global game_is_on
while game_is_on == True :
if apple.collidepoint(pos):
print("Good Shot!")
score = score +1
print(score)
place_apple()
game_is_on = True
else:
print("You missed!")
ans = input("Do you want to play again? \"Yes\" or \"No\"?")
print(ans)
if (ans == "Yes"):
game_is_on = True
else:
quit()```
here
או וואו
ממש עזרת חביבי
oh thanks
Dude come on
im osrry it was so demanding itttt
listen we are like
we need a role
for israeli
technoblade ur MIC IS MUTED
guys why is spotify developer site all messed up
i dont know if others see the same thing
someone pls help
Spotify is blocked in my country thus dont have an account. There may be some variations due to it
w,p,c6+w,q,c8+w,p,g7+w,k,e5+b,b,b2+b,p,f3+b,k,f1
"b" = Black
"w" = White
Rank
"q" = Queen
"k" = King
"b" = Bishop
"r" = Rook
"n" = Knight
"p" = Pawn
def move(letterx):
def move (abc):
a: piece
b: letter
c: number
map:
a: 1
b: 2
c: 3
d: 4
e: 5
f: 6
g: 7
h: 8
array[b][c] = a
!dict
iterate-dict
dictcomps
dict-get
You learning python?
Oh Nice
Uni student?
I'm just a school student
I finished 11 year
12 year
I'm also a beginner in python.
!server
@wide aurora
So now filling around with having my code skip three randomly chosen number. I found the next function, does it have to be defined before the range? here the code phy def sleepingRange(): firstNumber = random.randint (1, 10) secondNumber = random.randint (1, 10) thirdNumber = random.randint (1, 10) for number in range(12): print(number) for _ in range(6): time.sleep(0.5) print("z") if number == (firstNumber, secondNumber, thirdNumber): next (number) phy
Hey! I have a Q: In windows I could press alt + 122 or any number and it would give the ascii char. How can i do it in Linux? Ubuntu
range_iterator object at 0x00000264CD213C70>
The initial answer yielded the same thing I initially said to myself: it's an iterable, not an interator. But then, that wouldn't explain why this works, if both are simply generators:
x = (i for i in range(30))
next(x)
0
If anyone knows how to tell to skip numbers in a list while keeping my code, sort of stuck
my code phy def sleepingRange(): firstNumber = random.randint (1, 10) secondNumber = random.randint (1, 10) thirdNumber = random.randint (1, 10) for number in range(12): print(number) for _ in range(6): time.sleep(0.5) print("z") if number in (firstNumber, secondNumber, thirdNumber): not (firstNumber, secondNumber, thirdNumber) phy
hello yousself
firstNumber = random.randint (1, 10)
secondNumber = random.randint (1, 10)
thirdNumber = random.randint (1, 10)
for number in range(12):
print(number)
for _ in range(6):
time.sleep(0.5)
print("z")
if number != firstNumber:
print (number)
if number != secondNumber:
print (number)
if number != thirdNumber:
print (number) ```
Define a function which will take three int arguments, all of which will be greater than 0 and less than 11 (you do not need to test for this here). The purpose of the function is to display a count from 1 to 10 with a three second pause between each count with a “Z” being displayed on the screen every ½ a second. However the count will skip the three numbers passed into the function.
def sleepingRange(first, second, third):
!!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.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.
wow
Hi guys
Someone can help me solve a problem folks?
i'm struggle with one problem in python, if someone have time please
trying to rank a dictionary, with teams
[{'team': 'América Mineiro', 'total_of_points: 0, 'games_played': 0, 'goals': 0, 'goals_pro': 0}, {'team': 'Avaí', 'total_of_points': 0, 'games_played': 0, 'goals': 0, 'goals_pro': 0}, {'team': 'Botafogo-SP', 'total_of_points': 0, 'games_played': 0, 'goals': 0, 'goals_pro': 0}]
something like this, how i cant get the more higher scores
in "total_of_points"?
i make a several things unsuccessfully
hey guys I got a question
so im trying to take an image and basically mask and filter it to only take in white
using opencv
then take pytess to turn it from image to text
its having trouble with differentiating w's y's and sometimes numbers too
I wanna know how I can refine the image to make it easier to read
the white text bleeds into red adn black so idk how im supposed to get it to work exactly
!server
2
:incoming_envelope: :ok_hand: applied mute to @frank patio until 2021-02-21 21:43 (9 minutes and 59 seconds) (reason: burst rule: sent 8 messages in 10s).
how do i get into vc
Need help I got cash I wanna like watch and take it like a learnin andand grow.
No I wanna learn how to code python
@primal bison Please don't try to ping @everyone or @here. Your message has been removed. If you believe this was a mistake, please let staff know!
bro u can learn python for free. youtube is the way
like 5 sec searching
https://www.youtube.com/watch?v=rfscVS0vtbw dude here did a 4hour video
This course will give you a full introduction into all of the core concepts in python. Follow along with the videos and you'll be a python programmer in no time!
⭐️ Contents ⭐
⌨️ (0:00) Introduction
⌨️ (1:45) Installing Python & PyCharm
⌨️ (6:40) Setup & Hello World
⌨️ (10:23) Drawing a Shape
⌨️ (15:06) Variables & Data Types
⌨️ (27:03) Working...
and bro u dont need to spend lots of money fr fr
Byte of python is the best free discord book.
Can anyone help me with some HW?
hi
anyone know any aerodynamics panel method programming?
i need some good Text Editors, (not pycharm it wont download for some reason)
Vs code
Sublime is meh
alr
Hi
with what ?
import onyx
while True :
text = input("ONYX > ")
result, error = onyx.run('<stdin>', text)
if error:
print(error.as_string())
else:
print(result)
<@&267629731250176001>
@scenic pine Is there anything you need moderated?
No I was asking some questions about the server
but I should have done mod mail
I am so sorry
Right, please refrain from pinging the entire moderation team next time, @subtle palm works fine for this
👍
although... modmail does just that right?
I suppose it's a matter of here vs everyone
Hello
Guys
how are u?
Where channel for russian?
or ur dont have this voice and channel?
help plz
if someone can answer, this.
what does the break statement do ?
for instance
If:
something
break
else:
something
what does the break do here
wht does the break do here
!docs break
b(reak) [([filename:]lineno | function) [, condition]]```
With a *lineno* argument, set a break there in the current file. With a *function* argument, set a break at the first executable statement within that function. The line number may be prefixed with a filename and a colon, to specify a breakpoint in another file (probably one that hasn’t been loaded yet). The file is searched on [`sys.path`](sys.html#sys.path "sys.path"). Note that each breakpoint is assigned a number to which all the other breakpoint commands refer.
If a second argument is present, it is an expression which must evaluate to true before the breakpoint is honored.
Without argument, list all breaks, including for each breakpoint, the number of times that breakpoint has been hit, the current ignore count, and the associated condition if any.
!break
inconsistent fucking spaces if num!= 6 what the fuck
!e
x = [1,2,3]
for i in x:
print(i)
if i == 2:
break
@vernal snow :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 2
!e
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code
block. Code can be re-evaluated by editing the original message within 10 seconds and
clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an
issue with it!*
@manic oak :x: Your eval job has completed with return code 1.
001 | Guess the number between 1-10: Traceback (most recent call last):
002 | File "<string>", line 16, in <module>
003 | File "<string>", line 7, in GameNumber
004 | EOFError: EOF when reading a line
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
im trying to figure out a way to make a list of certain tuples in a dictionary after doing a loop on the dictionary, can I talk to someone so I can explain my problem a little better?
!e
my_dict = {
"a": ("a", "b", "c")
}
values_of_a = my_dict["a"]
print(values_of_a)
list_of_a = list(values_of_a)
print(list_of_a)
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | ('a', 'b', 'c')
002 | ['a', 'b', 'c']
@wide aurora Do you need any help?
!e
product_values = {
"shampoo": 5,
"orange": 0.99,
"apple": 1.25
}
print("shampoo costs: ", product_values["shampoo"])
print("orange costs: ", product_values["orange"])
print("apple costs: ", product_values["apple"])
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | shampoo costs: 5
002 | orange costs: 0.99
003 | apple costs: 1.25
aDict = dict(zip(productList, priceList))
!docs dict
class dict(**kwarg)``````py
class dict(mapping, **kwarg)``````py
class dict(iterable, **kwarg)```
Return a new dictionary initialized from an optional positional argument and a possibly empty set of keyword arguments.
Dictionaries can be created by several means:
• Use a comma-separated list of `key: value` pairs within braces: `{'jack': 4098, 'sjoerd': 4127}` or `{4098: 'jack', 4127: 'sjoerd'}`
• Use a dict comprehension: `{}`, `{x: x ** 2 for x in range(10)}`
• Use the type constructor: `dict()`, `dict([('foo', 100), ('bar', 200)])`, `dict(foo=100, bar=200)`
... [read more](https://docs.python.org/3/library/stdtypes.html#dict)
Yes
!e
product_costs = {
"Apple": 0.25,
"Orange": 1.05,
"Shampoo": 3,
}
products_bought = []
money_spent = 0
for item in ["Apple", "Orange", "Orange", "Apple", "Shampoo"]:
cost = product_costs[item]
products_bought.append((item, cost))
money_spent += cost
print(f"Money Spent: ${money_spent:.2f}")
print(f"Items bought: {products_bought}")
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | Money Spent: $5.60
002 | Items bought: [('Apple', 0.25), ('Orange', 1.05), ('Orange', 1.05), ('Apple', 0.25), ('Shampoo', 3)]
def groceryShopping(groceryList, priceList, budget):
groceryBought = []
aDict = dict(zip(groceryList, priceList))
for key in aDict:
while budget > 0:
budget -= aDict[key]
groceryBought.append((key, aDict[key]))
return groceryBought
groceryList = ["apple", "eggs", "doughnuts", "bread", "milk", "coffee"]
priceList = [2.50, 6.00, 3.75, 2.00, 3.40, 12.99]
budget = 13.50
print(groceryShopping(groceryList, priceList, budget))
!e
def groceryShopping(groceryList, priceList, budget):
groceryBought = []
aDict = dict(zip(groceryList, priceList))
for key in aDict:
while budget > 0:
budget -= aDict[key]
groceryBought.append((key, aDict[key]))
return groceryBought
groceryList = ["apple", "eggs", "doughnuts", "bread", "milk", "coffee"]
priceList = [2.50, 6.00, 3.75, 2.00, 3.40, 12.99]
budget = 13.50
print(groceryShopping(groceryList, priceList, budget))
@cosmic elk :white_check_mark: Your eval job has completed with return code 0.
[('apple', 2.5), ('apple', 2.5), ('apple', 2.5), ('apple', 2.5), ('apple', 2.5), ('apple', 2.5)]
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | Apple
002 | Orange
003 | Shampoo
!e
def groceryShopping(groceryList, priceList, budget):
groceryBought = []
aDict = dict(zip(groceryList, priceList))
while budget - min(aDict.values()) > 0:
for key in aDict:
cost = aDict[key]
if budget - cost < 0:
continue # Not enought money to continue
else:
budget -= cost
groceryBought.append((key, aDict[key]))
return groceryBought
groceryList = ["apple", "eggs", "doughnuts", "bread", "milk", "coffee"]
priceList = [2.50, 6.00, 3.75, 2.00, 3.40, 12.99]
budget = 30
items_bought = groceryShopping(groceryList, priceList, budget)
print(items_bought)
print(sum(i[1] for i in items_bought))
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | [('apple', 2.5), ('eggs', 6.0), ('doughnuts', 3.75), ('bread', 2.0), ('milk', 3.4), ('apple', 2.5), ('eggs', 6.0), ('doughnuts', 3.75)]
002 | 29.9
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | [('apple', 2.5), ('eggs', 6.0), ('doughnuts', 3.75)]
002 | 12.25
!e
def groceryShopping(groceryList, priceList, budget):
i = 1
while sum(priceList[:i+1]) < budget:
i += 1
return [(groceryList[num], priceList[num]) for num in range(i)]
groceryList = ["apple", "eggs", "doughnuts", "bread", "milk", "coffee"]
priceList = [2.50, 6.00, 3.75, 2.00, 3.40, 12.99]
budget = 13.50
items_bought = groceryShopping(groceryList, priceList, budget)
print(items_bought)
print(sum(i[1] for i in items_bought))
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | [('apple', 2.5), ('eggs', 6.0), ('doughnuts', 3.75)]
002 | 12.25
!e
my_tuple = (34634,1235,1321,345,123,346543,1232354,ord("a"))
print(f"Max Values: {max(my_tuple)}")
print(f"Min Values: {min(my_tuple)}")
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
001 | Max Values: 1232354
002 | Min Values: 97
!doc ord
ord(c)```
Given a string representing one Unicode character, return an integer representing the Unicode code point of that character. For example, `ord('a')` returns the integer `97` and `ord('€')` (Euro sign) returns `8364`. This is the inverse of [`chr()`](#chr "chr").
I need help to complete my program
def moyenne(nom):
if nom in Durand:
notes = resultats[nom]
total_points = {'Durant':[0]}
print(total_points)
total_coefficients = {'Durant':[1]}
for i in notes.values():
note, coefficient = valeurs
total_points = total_points + 2 *coefficient
total_coefficients = 2 +coefficient
return round(total_points/total_coefficeints ,1)
else:
return -1
resultats = {'Dupont':{'DS1':[15.5,4],'DM1':[14.5,1],'DS2':[13,4],'PROJET1':[16,3],'DS3':[14,4]}}, {'Durand':{'DS1':[6,4],'DM1':[14.5,1],'DS2':[8,4],'PROJET1':[9,3],'DS3':[8,4],'IE1':[7,2],'DS4':[15,4]}}
Hey @static slate!
Uh-oh! It looks like your message got zapped by our spam filter. We currently don't allow .txt attachments, so here are some tips to help you travel safely:
• If you attempted to send a message longer than 2000 characters, try shortening your message to fit within the character limit or use a pasting service (see below)
• If you tried to show someone your code, you can use codeblocks
(run !code-blocks in #bot-commands for more information) or use a pasting service like:
👁️
need help @primal bison ?
can i get some help regarding the calendar module in a vc?
Iterating over range(len(...)) is a common approach to accessing each item in an ordered collection.
for i in range(len(my_list)):
do_something(my_list[i])
The pythonic syntax is much simpler, and is guaranteed to produce elements in the same order:
for item in my_list:
do_something(item)
Python has other solutions for cases when the index itself might be needed. To get the element at the same index from two or more lists, use zip. To get both the index and the element at that index, use enumerate.
!warn 757562838834479124 Not entirely sure why you thought trying to do a !slut command was appropriate, but I'm here to tell you that it isn't.
:incoming_envelope: :ok_hand: applied warning to @fervent spire.
num = [0 , 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6]
num1 = []
for i in num:
if i != 0:
num1.append(i)
for i in num1:
print(i, end=' ')
101
num = map(str,num1)
ans = [ele.lstrip('0') for ele in test_list]
!e```python
num = ['0' , '0', '0', '0', '0', '0', '1', '2', '3', '4', '5', '6']
num1 = [0 , 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6]
num = map(str,num1)
# Python3 code to demonstrate
Remove leading 0 from Strings List
using lstrip() + list comprehension
# Initializing list
test_list = ['012', '03', '044', '09']
printing original list
print("The original list is : " + str(num1))
Remove leading 0 from Strings List
using lstrip() + list comprehension
res = [ele.lstrip('0') for ele in num]
printing result
print ("The string list after leading 0 removal : " + str(res))
num = [0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 0, 0]
p = True
new_num = []
for i in range(len(num)-1):
if num[i] == 0 and num[i+1] != 0:
p = False
if not p:
new_num.append(num[i+1])
print(new_num)```
itertools.dropwhile(predicate, iterable)```
Make an iterator that drops elements from the iterable as long as the predicate is true; afterwards, returns every element. Note, the iterator does not produce *any* output until the predicate first becomes false, so it may have a lengthy start-up time. Roughly equivalent to:
```py
def dropwhile(predicate, iterable):
# dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1
iterable = iter(iterable)
for x in iterable:
if not predicate(x):
yield x
break
for x in iterable:
yield x
!code
def dropwhile(predicate, iterable):
# dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1
iterable = iter(iterable)
for x in iterable:
if not predicate(x):
yield x
break
for x in iterable:
yield x
looool
@buoyant kestrel is sheet
can i get a unmute
hello
hello
!e
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code
block. Code can be re-evaluated by editing the original message within 10 seconds and
clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an
issue with it!*
@brisk crest :x: Your eval job has completed with return code 1.
001 | File "<string>", line 3
002 | while "True"
003 | ^
004 | SyntaxError: invalid syntax
Is there a known way to get answers in google forms?
as in scrape the responses?
ik you could set it up so you have a sheet with the responses
and then use the Google API to grab it
@snow moss u use mint ?? 
ya
bruh, why light mode
what light mode
@snow moss what are you doing with your life lol
why the mouse is so big
why light mode
I use dark mode for pycharm
I don't have an editor for C
Mint is nice
you use C?
Me?
C is awesome
I needed a lightweight OS
Debian bro
I don't use arch btw
me neither
Have you used i3 window manager yet?
yes
no
I was changing it's configuration parser
it was written in C
I was interested in the way they did that
actually they used another lib for that
other than writing it their own
Same
same?
wdym
@tulip grail yo o/
what is up
what the fuck lmao
@snow moss share ur thing again, i was enjoying blaming u lmao
jk
I am stuck in linked list hell
You messed with discrete binary searches yet?
wait, how do you know
How do I know binary search trees?
@snow moss but i feel stronger if u share ur screen lel
I’ve done adding stuff before the head, after the tail, between nodes
idk, it's just good
Because someone is sleeping
oh
yeah
yeah
Anyways I’m gonna go to bed soon
same
11:41
pm?
sure
Yep PM
yea
Have you used CentOS 8 yet?
not that much
just tested it live
but i used fedora
it was very cool
class Defaults(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_member_join(self, member):
print(member)
class BotSkeleton:
def __init__(self, prefix, token):
self.prefix = prefix
self.token = token
self.bot = commands.Bot(command_prefix=self.prefix)
self.bot.remove_command("help")
self.bot.add_cog(Defaults(self))
How do I go about fixing this?```
print(datetime.fromtimestamp(int(1615228750203)))
OSError: [Errno 22] Invalid argument
player.last_login = player_data['player']['lastLogin']
player.last_login = datetime.datetime.fromtimestamp(int(player.last_login) // 1000).strftime('%Y-%m-%d %I:%M %p')
class Player:
def __init__(self):
self.uuid = ''
self.name = ''
self.rank = ''
self.karma = ''
self.first_login = ''
self.last_login = ''
self.networkLevel = ''
I was building a chess game with pygame
But i am having a lot of trouble
what do i do?
Make sure you understand each bit of code you write, and if you don't understand your code then I would recommend to just refresh your memory.
Hi, I need some help to initiate my code if someone is there
so I've made a voice assistant and to initiate the code of that voice assistant I always have to open my pycharm. So is there any way in which the code can run in the background without opening pycharm.
@mighty storm
Alright
@dataclass
class OverallStatsAPI:
"""Dataclass for organizing API requests"""
uuid:
name:
rank:
karma:
first_login:
last_logout:
networkLevel:
def __init__(self, username, uuid: int, name:, rank:, karma:, first_login:, last_logout:, networkLevel):
self.uuid =
self.name =
Ohh right. You don't need an __init__ unless you want to customise it.
!eval ```py
from dataclasses import dataclass
@dataclass
class Foo:
a: int
b: str
foo = Foo(42, 'hello world')
print(foo)
@cold lintel :white_check_mark: Your eval job has completed with return code 0.
Foo(a=42, b='hello world')
You can give default values by just assigning values to the field of the dataclass.
Not sure what you're asking sorry
def(self, username, uuid:, name:, rank:, karma:, first_login:, last_logout: networkLevel:):
data = requests.get(f"https://api.mojang.com/users/profiles/minecraft/{username}")
uuid = data.json()
player.uuid = uuid["id"]
Yeah, you need to specify the type of each of the fields of a dataclass.
I mean, kind-of
Python won't complain if you don't 😄
uuid: int
name: str
rank: str
karma: int
first_login: str
last_logout: str
networkLevel: str
However, I would recommend adding an alternative constructor, rather than overwriting __init__
Like, for example: ```py
@dataclass
class Square:
side_len: float
@classmethod
def from_area(cls, area: float):
return cls(side_len=math.sqrt(area))
Then you would do ```py
square = Square.from_area(4)
Writing your own __init__ sort of defeats the point of using dataclass
😄
That's an argument passed into the function Square.from_area
The idea in this case is we want a way to construct a square from the area.
So, in your case, what does the dataclass represent?
@classmethod
def APICalls(cls, uuid, name, rank, karma, first_login, last_logout, networkLevel):
Oh right, so the fields of the dataclass represent the values returned by a request to an API?
Sorry, I'm a bit slow today 😄
Right, so you want a method that carries out the request and constructs an instance from the returned data...
Slushs
@classmethod
def APICalls(cls, uuid: int, name: rank, karma, first_login, last_logout, networkLevel):
So, what does this do?
Given X, you get back Y. What are X and Y?
Alright
@buoyant kestrel can Jake have screen share permissions?
Pinged him too 😄
So, given a username, you want to download all the info for that user from the API and put it in an instance of this dataclass?
Riight
So, usage would be something like OverallStatsAPI.from_username('slushs')?
Right, so this is for a command for a discord bot?
And the argument to the command is the username?
@dataclass
class OverallStatsAPI:
"""Dataclass for organizing API requests"""
uuid: int
name: str
rank: str
karma: int
first_login: str
last_logout: str
networkLevel: str
@classmethod
def from_username(cls, username: str):
...
return OverallStatsAPI(
uuid = uuid,
name = ...,
...
)
Yeah, well I'm assuming the plan is to use the first API to get the UUID from the username, then use the second API to get the data, and use that data to populate the dataclass instance?
Can you paste the original function here?
Oh, I mean the function you were talking about.
Dataclass function 😄
Nvm
Wait, Jake, I think you're confused about this. See the change I just made to the code above.
That should provide a template to fill in.
The data you want to put in the object 😄
funny jake
You won't need the type annotations in the call to the constructor.
They're just keyword arguments, so it's = rather than :
Missing commas and values
that's why PyCharm is complaining.
I use Vim 
Yeah, it takes a while to get used to the shortcuts.
Yep
Yeah, well, you're going to do some processing on the data, right?
So that all needs to come before you actually construct the dataclass instance.
No no, I mean, inside that method.
@dataclass
class OverallStatsAPI:
"""Dataclass for organizing API requests"""
uuid: int
name: str
rank: str
karma: int
first_login: str
last_logout: str
networkLevel: str
@classmethod
def from_username(cls, username: str):
# Use first API to get UUID from username.
# Download data from second API using UUID.
# Extract the information you want from the raw data downloaded from the second API.
# Construct the instance of the dataclass and return it:
return OverallStatsAPI(
uuid = uuid,
name = ...,
...
)
Go with a light theme 😄
Ouch
Yeah that's pretty bad, I take it back
Why am I muted?
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Ok thank you!
Any time
Also sorry, I try not to just drop links. Always feels like it's rude when I do that
Your good!
Why do you have a classmethod in a classmethod?
Not sure what you mean?
Ah, that's a dataclass
Was talking to @sturdy geyser
Jake, yes you could do uuid = data.json()['id']
Tenth time lucky 😄
Oh, he's making a command for a discord bot.
And getting to grips with dataclasses.
IDK about pycharm shortcuts sorry.
If he is trying to access data from an API with async I would recommend using aiohttp instead of requests
It's not mandatory but if you care about performance it is important
I think you misunderstood me, instead of making GET, POST, DELETE, etc requests with the requests module, if you are using this data class in a Discord bot, I would recommend using the aiohttp module instead of the requests module for better performance, luckily requests and aiohttp are very similiar.
Ok got it! 
Is this code on Github?
I would avoid * imports in most cases btw Jake.
Because it's not as obvious what names have been created by the import.
The class I think.
Also something minor I noticed, instead of doing this
requests.get(f'https://thing.api?{key}={value}')
You should use the params keyword argument
requests.get(f'https://thing.api', params={key: value})
Is the latter approach less vulnerable @hybrid vortex?
Ya I think so
Ah 😄
The error message usually has the file and line number.
Check the traceback
Hello @mellow stump
!eval ```py
print(''.join(chr(int(x, base=2)) for x in '01000110 01010101'.split()))
@cold lintel :white_check_mark: Your eval job has completed with return code 0.
FU

That was urek's status 😄
Yo Griff
That's my name...
😄
I said "pasta" once in voice chat.
Maybe
I am a guy though. Sorry to ruin the mystique.
Jake, is your code for this bot on GitHub?
please do
Oh wait
You weren't using the alternative constructor?
Erm, Jake really wanted to use a dataclass 😄
Earlier I recommended writing an alternative constructor:
Griff, check the previous discusssion 
No one else was here 😄
Alright, it's ok 😄
Yeah, so you could have a separate function that returns an instance of the dataclass, or you could make this function a method of the dataclass...
I think the original problem Jake was having was that he had a function that returned too many values to keep track of.
And Hemlock recommended a dataclass.
(NamedTuple also serves this purpose)
from dataclasses import dataclass
!e
from dataclasses import dataclass
@dataclass
class UserData:
name: str
attribute: str
class ApiThing:
def __init__(self):
...
def get_user(self, user_id) -> UserData:
return UserData("Jake", "Smelly")
my_api = ApiThing()
user = my_api.get_user(123122345834587)
print(user.name, "is", user.attribute)
@wide aurora :white_check_mark: Your eval job has completed with return code 0.
Jake is Smelly
Yeah, I usually restructure my programs like 10 times before I'm happy 😄
Uppercase method names 
Probably not rust...
Yeah 😄
😔
Yeah Jake, can you please use snake_case 😄
player = OveralStatsAPI.from_user(username)
int(karma.replace(','. ''))
Video from Vampire Weekend for the single 'Oxford Comma' directed by Richard Ayoade.
Purchase Vampire Weekend on vinyl at XL Recordings: https://xlrecordings.com/buy/vampireweekend-vampireweekend
link
OK Go
That was their first one I think. This one is kind of amazing: https://www.youtube.com/watch?v=QvW61K2s0tA
They filmed the whole video in like 5 seconds then slowed it down 😄
i watch
what is the best platform for a marco in related programs in office 365
java ppython c++
lets see
do it rn
dont just ping random people
ok
sorry
why are you server muted btw?
idk
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
!e
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code
block. Code can be re-evaluated by editing the original message within 10 seconds and
clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an
issue with it!*
!e def sum_even(start,end):
ans=0
for i in range(start,end):
if i%2==0:
ans+=i
return ans
print(sum_even(6,16))
@toxic marsh :white_check_mark: Your eval job has completed with return code 0.
50
!e
!eval [code]
Can also use: e
*Run Python code and get the results.
This command supports multiple lines of code, including code wrapped inside a formatted code
block. Code can be re-evaluated by editing the original message within 10 seconds and
clicking the reaction that subsequently appears.
We've done our best to make this sandboxed, but do let us know if you manage to find an
issue with it!*
!e ```py
def sum_even(start,end):
ans=0
for i in range(start,end):
if i%2==0:
ans+=i
return ans
print(sum_even(6,16))
@toxic marsh :white_check_mark: Your eval job has completed with return code 0.
50
!e
def sum
I am new to coding kind of, and can someone please explain id there is anyway to make an object using the console, for instance input() = object.name ?
or to change the variable in the object in t he console
Hey, you can do it like this:
class Person:
def __init__(self, name=None):
self.name = name
p1 = Person("Peter")
print(p1.name)
p1.name = input("Enter the new name: ")
print(p1.name)
Release of my FiveM discord bot, if you have trouble, join my discord
Discord: https://discord.gg/GWZsjkJ
Source-Code: https://github.com/vsousa14/vsousa14_FiveM-Discord-Bot
If you have suggestions, or you would like to see something in this bot, make your suggestion in my discord server.
Track: Au5 - Interstellar (feat. Danyka Nadeau) [NCS R...
hey is anyone free to help me with coding?
i just need someone to help guide me through my homework cuz im really lost
:incoming_envelope: :ok_hand: applied mute to @primal bison until 2021-03-14 05:08 (9 minutes and 58 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
Awesome
wht
netstat -aof | findstr :25565
@jagged basin go to server properies
and then change the online mode to false
it bugs when you have mods
ping yourip:25565
local ip
curl host:port
@wide aurora are your local ip static?
@jagged basin do you have anything hosted on server?
and it is a windows server computer
in cmd type ngrok -help see if it work
Test-NetConnection 192.168.1.1 -p 25565
Need hlep with git psuh heroku master
is it forwared by the router?
@jagged basin go to open port checker and then type your public ipv4 with the port
Here
@jagged basin is you public ip and wan ipv4 different?
@primal bison
CTRL + K to commit
CTRL + SHIFT + K to push
@jagged basin the ip that your router shows in its homepage
they are not i think
like this
router show the public ip in its homepage, i think?
you dont have that?
ok
it show at dashboard on my router
@jagged basin you can try ngrok
AND NOW WATCH my brand new updated even better tutorial that teaches you how to make a free Minecraft server with PLUGINS AND MODS!:
https://youtu.be/xhKY5WQ9VUw
Today TutGamer475 shows you the be...
watch this it is just a tunnel maker to host the server
ok
def stringy(size):
string = ""
switch = True
for i in range(size):
if switch:
string += "1"
switch = False
else:
string += "0"
switch = True
return string
def stringy(size):
return ''.join(str(int(not(i%2)))for(i)in(range(size)))
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_basic_cases() {
assert_eq!(generate_range(2, 10, 2), [2,4,6,8,10]);
assert_eq!(generate_range(1, 10, 3), [1,4,7,10]);
assert_eq!(generate_range(1, 10, 1), [1,2,3,4,5,6,7,8,9,10]);
assert_eq!(generate_range(1, 10, 4), [1,5,9]);
assert_eq!(generate_range(1, 10, 5), [1,6]);
}
}
// Add your tests here.
// See https://doc.rust-lang.org/stable/rust-by-example/testing/unit_testing.html
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn basic_tests() {
assert_eq!(is_divide_by(8, 2, 4), true);
assert_eq!(is_divide_by(12, -3, 4), true);
assert_eq!(is_divide_by(8, 3, 4), false);
assert_eq!(is_divide_by(48, 2, -5), false);
assert_eq!(is_divide_by(-100, -25, 10), true);
assert_eq!(is_divide_by(10000, 5, -3), false);
assert_eq!(is_divide_by(4, 4, 2), true);
assert_eq!(is_divide_by(5, 2, 3), false);
assert_eq!(is_divide_by(-96, 25, 17), false);
assert_eq!(is_divide_by(33, 1, 33), true);
}
}
fn is_divide_by(number: i32, a: i32, b: i32) -> bool {
todo!()
}
fn is_divide_by(number: i32, a: i32, b: i32) -> bool {
return number % a == 0 && number % b == 0;
}
#[cfg(test)]
mod tests {
use super::zero_fuel;
#[test]
fn sample_tests() {
assert_eq!(zero_fuel(50, 25, 2), true);
assert_eq!(zero_fuel(100, 50, 1), false);
}
}
fn zero_fuel(distance_to_pump: u32, mpg: u32, gallons: u32) -> bool {
unimplemented!();
}
fn zero_fuel(distance_to_pump: u32, mpg: u32, gallons: u32) -> bool {
return mpg * gallons >= distance_to_pump;
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn basic_tests() {
assert_eq!(expressions_matter(2, 1, 2), 6);
assert_eq!(expressions_matter(1, 1, 1), 3);
assert_eq!(expressions_matter(2, 2, 4), 16);
assert_eq!(expressions_matter(3, 3, 3), 27);
assert_eq!(expressions_matter(2, 1, 1), 4);
assert_eq!(expressions_matter(1, 2, 3), 9);
assert_eq!(expressions_matter(1, 3, 1), 5);
assert_eq!(expressions_matter(2, 2, 2), 8);
assert_eq!(expressions_matter(5, 1, 3), 20);
assert_eq!(expressions_matter(3, 5, 7), 105);
assert_eq!(expressions_matter(5, 6, 1), 35);
assert_eq!(expressions_matter(1, 6, 1), 8);
assert_eq!(expressions_matter(2, 6, 1), 14);
assert_eq!(expressions_matter(6, 7, 1), 48);
assert_eq!(expressions_matter(2, 10, 3), 60);
assert_eq!(expressions_matter(1, 8, 3), 27);
assert_eq!(expressions_matter(9, 7, 2), 126);
assert_eq!(expressions_matter(1, 1, 10), 20);
assert_eq!(expressions_matter(9, 1, 1), 18);
assert_eq!(expressions_matter(10, 5, 6), 300);
assert_eq!(expressions_matter(1, 10, 1), 12);
}
}
fn expressions_matter(a: u64, b: u64, c: u64) -> u64 {
// Your Code here... Happy Coding!
}
👁️
fn expressions_matter(a: u64, b: u64, c: u64) -> u64 {
match vec![a*b*c, (a+b)*c, a*(b+c), a+b+c, (a*b)*c, a*(b*c)].iter().max() {
Some(max) => return *max,
None => panic!("No Input"),
}
}
||def expression_matter(a, b, c): return max(a*b*c, a+b+c, (a+b)*c, a*(b+c))||
void _if(bool value, std::function<void(void)> func1, std::function<void(void)> func2)
{
value ? func1() : func2();
}
def _if(...):
func1() if bool else func2()
||Hey ass hole||
|| ur mother ||
fn infected(s: &str) -> f64 {
let mut count: f64 = 0.0;
for sub in s.split('X'){
if sub.contains('1') {
count += sub.len() as f64;
}
}
let total: i64 = (s.len() - s.matches('X').count()) as i64;
if total == 0 || count == 0 as f64 {
return 0 as f64;
}
return 100.0 * count / (total as f64);
}
def infected(s):
infected = 0
total_population = 0
string = s.split("X")
for i in string:
total_population += len(i)
if "1" in i:
infected += len(i)
try:
percentage = 100*infected/total_population
except ZeroDivisionError:
return 0
return percentage
@wide aurora see
I am not a failure
lets gooo

que = input("Encrypt or decrypt?(e, d): ")
if que == "d":
inp = input("Text to decrypt: ")
else:
inp = input("Text to encrypt: ")
a = {
"q": 0,
"a": 1,
",": 2,
"y": 3,
"x": 4,
"-": 5,
"s": 6,
"w": 7,
"e": 8,
";": 9,
"d": 10,}
b = {
0: "q",
1: "a",
2: ",",
3: "y",
4: "x",
5: "-",
6: "s",
7: "w",
8: "e",
9: ";",
10: "d",}
out = ""
if que == "d":
for _ in range(len(inp)):
out += b[a[inp[_]] + 1 if _ % 2 != 0 else a[inp[_]] - 1]
else:
for _ in range(len(inp)):
out += b[a[inp[_]] - 1 if _ % 2 != 0 else a[inp[_]] + 1]
print("\n"+out)
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.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.
!e ```py
the_list = [str(i) for i in range(10)]
print(the_list[1:])
print(the_list[1:4])
print(the_list[::-1])
print(the_list[:-1])
@safe mesa :white_check_mark: Your eval job has completed with return code 0.
001 | ['1', '2', '3', '4', '5', '6', '7', '8', '9']
002 | ['1', '2', '3']
003 | ['9', '8', '7', '6', '5', '4', '3', '2', '1', '0']
004 | ['0', '1', '2', '3', '4', '5', '6', '7', '8']
!e ```py
print('this is a message'[::-1])
@safe mesa :white_check_mark: Your eval job has completed with return code 0.
egassem a si siht
!e
var = 122
for i in range(26):
print(chr(var))
var += -1
@hexed nexus :white_check_mark: Your eval job has completed with return code 0.
001 | z
002 | y
003 | x
004 | w
005 | v
006 | u
007 | t
008 | s
009 | r
010 | q
011 | p
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/aseterimuh.txt
static ASCII_LOWER: [char; 30] = [
' ',
'z', 'y', 'x', 'w', 'v',
'u', 't', 's', 'r', 'q',
'p', 'o', 'n', 'm', 'l',
'k', 'j', 'i', 'h', 'g',
'f', 'e', 'd', 'c', 'b',
'a', '!', '?', ' '
];
fn switcher(numbers: Vec<&str>) -> String {
return numbers.into_iter().map(|num| ASCII_LOWER[num.parse::<u8>().unwrap() as usize]).collect();
}
enumerate
!e ```py
print(str(4))
@safe mesa :white_check_mark: Your eval job has completed with return code 0.
4
ln[str(index)]
str(index)
!e ```py
the_dict = {1: 'a', 2: 'b'}
print(the_dict.get(1))
@safe mesa :white_check_mark: Your eval job has completed with return code 0.
a
!e ```py
the_dict = {1: 'a', 2: 'b'}
print(the_dict.get(3))
@safe mesa :white_check_mark: Your eval job has completed with return code 0.
None
!e ```py
the_dict = {1: 'a', 2: 'b'}
print(the_dict[3])
@safe mesa :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | KeyError: 3
!e ```py
the_dict = {1: 'a', 2: 'b'}
value = the_dict.get(3)
if value:
print('Value found!')
else:
print('Not found.')
@safe mesa :white_check_mark: Your eval job has completed with return code 0.
Not found.
fn solution(s: &str) -> Vec<String> {
let mut output: Vec<String> = vec![];
for i in (0..s.len()).step_by(2) {
println!("{}", s[i..i+2].to_string());
output.append(s[i..i+2].to_string());
}
return output;
}
!src paginator
Unable to convert 'paginator' to valid command, tag, or Cog.
Unable to convert 'pagination' to valid command, tag, or Cog.
!src LinePaginator
Unable to convert 'LinePaginator' to valid command, tag, or Cog.
fn main() {
println!("Hello world");
}
?
Java relates to JavaScript the same as ham to hamster.
fn main() {
println!("hello world");
}

yahhhhhhhh mebbe tmrw
😔
lol
what should i search up if i'm trying to stop a while loop after printing n amount of values?
maybe i will get on my computer again 🤔
that sounds like a job for a for loop actually
beautiful
😦
so what should i look up? because i search "stop for loop after printing n amount of values python" but not much shows up
:)
lol
for x in range(9):
print(y, end=",")
if x == 3:
break
y = y + x
print(y)
!e ```py
y = 5
for x in range(9):
print(y, end=",")
if x == 3:
break
y = y + x
print(y)
@safe mesa :white_check_mark: Your eval job has completed with return code 0.
5,5,6,8,8
output: 5,5,6,8,8
!comparison
Assignment vs. Comparison
The assignment operator (=) is used to assign variables.
x = 5
print(x) # Prints 5
The equality operator (==) is used to compare values.
if x == 5:
print("The value of x is 5")
!e ```py
for x in range(9):
print(x)
@safe mesa :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 1
003 | 2
004 | 3
005 | 4
006 | 5
007 | 6
008 | 7
009 | 8
!e
print(x)
!e
print(2!)
@hexed nexus :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(2!)
003 | ^
004 | SyntaxError: invalid syntax
!e
import math
var = 3
for i in range(99):
var += - 1 / (math.factorial(i+2) * (i+1) * (i+2))
print(var)
@hexed nexus :white_check_mark: Your eval job has completed with return code 0.
2.7182818284590455
!e
import math
var = 3
for i in range(9999):
var += - 1 / (math.factorial(i+2) * (i+1) * (i+2))
@hexed nexus :warning: Your eval job timed out or ran out of memory.
[No output]
!e
fact = lambda n: 1 if n <= 0 else n * fact(n - 1)
print(1 + sum([1/fact(n) for n in range(1, 100)]))
@icy sky :white_check_mark: Your eval job has completed with return code 0.
2.7182818284590455
my_list = list(range(20))
print(*map(lambda x: x**2, my_list))
!e
@tasks.loop(seconds=8)
async def change_status():
await client.change_presence(activity=discord.ActivityType.watching(next(status)))```
@primal bison :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'tasks' is not defined
#Create a function to combine the values of the important columns into a single string
def get_important_features(data):
important_features = []
for i in range(0, data.shape[0]):
important_features.append(data['Actors'][i]+' '+data['Director'][i]+' '+data['Genre'][i]+' '+data['Title'][i])
return important_features #Create a column to hold the combined strings
df['important_features'] = get_important_features(df)
#Show the data
df.head(3)
This is my code although i am getting below error: Traceback (most recent call last)
<ipython-input-10-50d23e3e0015> in <module>()
1 #Create a column to hold the combined strings
----> 2 df['important_features'] = get_important_features(df)
3
4 #Show the data
5 df.head(3)
3 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/internals/construction.py in sanitize_index(data, index)
746 if len(data) != len(index):
747 raise ValueError(
--> 748 "Length of values "
749 f"({len(data)}) "
750 "does not match length of index "
ValueError: Length of values (1) does not match length of index (1000)
Please help
#Create a function to combine the values of the important columns into a single string
def get_important_features(data):
important_features = []
for i in range(0, data.shape[0]):
important_features.append(data['Actors'][i]+' '+data['Director'][i]+' '+data['Genre'][i]+' '+data['Title'][i])
return important_features #Create a column to hold the combined strings
df['important_features'] = get_important_features(df)
#Show the data
df.head(3)
This is my code although i am getting below error: Traceback (most recent call last)
<ipython-input-10-50d23e3e0015> in <module>()
1 #Create a column to hold the combined strings
----> 2 df['important_features'] = get_important_features(df)
3
4 #Show the data
5 df.head(3)
3 frames
/usr/local/lib/python3.7/dist-packages/pandas/core/internals/construction.py in sanitize_index(data, index)
746 if len(data) != len(index):
747 raise ValueError(
--> 748 "Length of values "
749 f"({len(data)}) "
750 "does not match length of index "
ValueError: Length of values (1) does not match length of index (1000)
Please help
Put it in here 😄
Hello, can anyone help me in extracting table from a website using .py script?
hey, please claim a help channel for your question, this is the channel for the code help voice chat.
#❓|how-to-get-help
i have already claimed 3 help channels with no response for my problem
[cat, 3]
That dint worked for me
strings = ["asd", "def", "hello"]
print(add_sizes(strings))
# [("asd", 3), ("def", 3), ("hello", 5)]
im sorry for that, maybe you could read https://pythondiscord.com/pages/asking-good-questions/ and then try again? this channel is really not the place and alread occupied.
We're a large, friendly community focused around the Python programming language. Our community is open to those who wish to learn the language, as well as those looking to help others.
It`s not the task but map is beautiful 😄
def add_sizes(strings: list[str]) -> list[tuple[int, str]]:
return [*map(lambda s: (s, len(s)), strings)]
This is not the solution
BRO
its random yes
lemme try help channel once again by pasting the console error, last time i posted my hastebin code with problem statement
to generate test cases
thank you, i forget the way to document "llist of strings" ! sooo usefull
irony?
noooo
Really?
why ?
yes
sorry
i meant the action of making a documentation
to documentate ?
no
i don't know
add_sizes = lambda S: [(s, len(s)) for s in S]
So you mean documentation like "typing" or what?
add_sizes = lambda strings: list(map(lambda s: (s, len(s)), string))
But it is 😄
Not really
true
!e ```py
my_list = [1, 2]
print(type(my_list))
my_tuple = (1, 2)
print(type(my_tuple))
@carmine current :white_check_mark: Your eval job has completed with return code 0.
001 | <class 'list'>
002 | <class 'tuple'>
Oh lol 😄
@carmine current How is it going?
Oh same
@carmine current I'm actually doing an exam which is against adults, and I can't wait to show them my skills and knowledge.
!e ```py
print(list("my string"))
@carmine current :white_check_mark: Your eval job has completed with return code 0.
['m', 'y', ' ', 's', 't', 'r', 'i', 'n', 'g']
!e ```python
print("my string".split())
@primal bison :white_check_mark: Your eval job has completed with return code 0.
['my', 'string']
print(list(puzzle.split))
!e ```python
print(list("my string")[0])
@primal bison :white_check_mark: Your eval job has completed with return code 0.
m
Lol
There is no voice
I want to type
!e ```py
a = [1, 3, 2]
a[1] = 5
print(a)
@carmine current :white_check_mark: Your eval job has completed with return code 0.
[1, 5, 2]
a[2] = ["a", "b", "c"]
!e ```py
a = ["a", "b", "c"]
index = 2
a[2] = ["a", "b", "c"]
print(a)
@carmine current :white_check_mark: Your eval job has completed with return code 0.
['a', 'b', ['a', 'b', 'c']]
44833
105809