#code-help-voice-text
5 messages · Page 7 of 1
hello
How long does it take for people to get assistance usually? Im new
key in dictionary should work
There’s a good chance you accidentally replaced your dictionary variable’s value with a function object. Something like dictionary = function where you forgot to actually call the function with brackets ()?
Hi,
I hope everyone is okay.
I am doing a research project for my Bachelor of IT (honours) on Machine Learning for Cloud Security.
This research paper discusses the Fraudulent Resource Consumption (FRC) Attack and uses Support Vector Machines (SVM) to detect cloud-based FRC attacks. Fraudulent Resource Consumption (FRC) attacks are created by slowly using cloud services' metered resources. The attacker's goal is to abuse the utility pricing model by stealing cloud resources. This skilful resource overuse results in a significant cost burden for the client. These assaults employ low-intensity HTTP requests per hour, like legitimate users. Due to this, FRC attacks are difficult to detect. FRC is an Economic Denial of Service (EDoS) attack that targets cloud adopters' financial resources by increasing their costs. Unlike DDoS assaults, which can temporarily block legitimate users from accessing services, EDoS attacks can significantly increase cloud users' costs. Support-vector machines (SVMs, also known as support-vector networks) are supervised learning models that examine data for classification and regression analysis.
Now I want guidance for a script that Can capture this generated FRC traffic, run SVM on it for training and then run SVM on it for testing. Training can be one script, and testing can be another script.
Secondly, is it possible to use AWS or Microsoft Azure to perform these testings
I shall be highly grateful if you could kindly guide me in this.
Thanks & regards,
Osama Faheem
Hi everyone,
I was wondering if anyone would be available to guide with a problem i am experiencing through RSA and socket
I think it needs live debugging as i've looked everywhere and can't find the issue
anyone got 5 min to help me with something small
hello
!voiceverify
random.randint(-10, 10)
howdy
@broken rune
are you here to help
im working on a coding lab thing
basically
you are opening a .txt file and extracting data from it
can you call by any chance?
it's tedious to explain
it's all good, im working with someone in the help channel and id prefer not to type everything twice
if you can voice call that'd be awesome though 
i just want to talk and show my code
man
?
OH LMAO
it was just a figure of speech
and it also just so happens to be your name
😅
yeah, I mean it's pretty reasonable tbh
lol
I need help in a python question
can anyone help?
You are given an integer n . you want to construct an array a such that the following conditions hold:
- a[1]=n
- no two adjacent elements should be equal
- For all i ( 1<= i < |A|) , such that A[i] is divisible by A[i+1]
Find the maximum possible length of the array A for the given integer n
Input Format
The first line contains an integer n denoting the given integer n
Constraints
1 <= n <= 10^6
i cant talk
Hello everyone
I need some help
so i have this code as I am trying to understand classes
...............
class Person:
def init(self, name, age):
self.name = name
self.age = age
def isOld(self) :
if self.age >= 60 :
return True
else :
return False
p1 = Person("John", 36)
print(p1.name)
print(p1.age)
print(p1.isOld)
. ..........................
yet for some reason p1.isOld is giving me a really weird output
which is "<bound method Person.isOld of <main.Person object at 0x000001107DB79630>>"
can some tell me what's going on and what to do to fix it please?
I am a beginner in python so I don' understand it and internet couldn't help
Hi, sorry for the late response, but the issue is that isOld is a function, and your just printing the function itself, not what it returns. You can fix it by adding brackets after isOld in print(p1.isOld), so, it becomes print(p1.isOld())
Thx
Heyy
Could anyone help me here
I'm trying to plot N particles in random position and assign each particle a speed that is given by some formulas
So my problem is soem of the particles seem as if they don't have a velocity
I guess the line of yvel inside the function intial_vel is the problem
Sorry the first picture is wrong it should be this one
Can anyone help me with openpyxl
need to know how to insert a column, have a base idea but not working
import openpyxl
wb = openpyxl.load_workbook(filename)
sheet = wb.worksheets[0]
sheet.insert_cols(2)
wb.save("filename.xlsx")
hope this helps 👆🏽
Hey does anyone know a similar function to append but for array?
Could anyone help me with wrapping my head around as to how I would implement Dijkstra in my current project?
I actually figured it out! I got the whole thing down, just having an issue applying a formula to multiple rows in the same column now
Any body can help with a task involving an algorithm and turning it into a python code
Where can I make 50 messages easily without disturbing anyone so I can join voice chat?
@celest herald you need help?
just chat in general or if you're good at python maybe look at help channels and help others or just hang out in whatever topical channel interests you 🙂
its really your wish
yeah
trying to artificially increase your message count will result in a voice mute
you will not be able to voice verify if you have an active voice mute infraction
Lol I always need help. Socially, Mentally, Financially, Spiritually, and with python.
haha
!stream 709014698221371404
✅ @full sail can now stream until <t:1647021292:f>.
!stream 709014698221371404 10M
✅ @full sail can now stream until <t:1647021952:f>.
!eval print([].index(7))
@fringe flax :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | ValueError: 7 is not in list
I missed what was said
@sly merlin i mean I will have to share screen how can I do?
import random
correct_number = random.randint(1,100)
guess_count = 0
while True:
player_guess = int(input("Guess the number: "))
if player_guess < 1 or player_guess > 100:
print("OUT OF BOUNDS")
continue
if guess_count == 0:
if player_guess <= (correct_number + 10) and player_guess >= (correct_number - 10):
print("WARM!")
else:
print("COLD!")
if guess_count > 0:
if (player_guess > last_guess and player_guess < correct_number) or (player_guess < last_guess and player_guess > correct_number):
print("WARMER!")
else:
print("COLDER!")
guess_count += 1
if player_guess == correct_number:
if guess_count == 1:
print("You have guessed correctly. It took you " + str(guess_count) + " guess")
else:
print("You have guessed correctly. It took you " + str(guess_count) + " guesses")
break
last_guess = player_guess
I have a large project that I am developing, but I don't have enough experience to make a convenient architecture (location of files/modules). Tell me what to do
wow
When did the verification thing turned up
im pretty sure i was talking here a while ago
Voice verification?
August 2020
I'm working on a school project and there's this one quiz program that doesn't give error but keeps giving me wrong results. I need help .. is there anyone available to help me check what's wrong?
!stream @cursive totem
✅ @cursive totem can now stream until <t:1647099309:f>.
!pate
» pathlib
» relative-path
» windows-path
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
if __name__ == "__main__":
ws = websocket.WebSocket()
try:
connect()
except Exception as err:
print(err)
print("Connect failed")
@tenacity.retry(wait=tenacity.wait_fixed(3))
def connect():
try:
ws.connect('wss://gateway.discord.gg/?v=6&encoding=json')
event = receive_json_request(ws)
heartbeat_interval = event['d']['heartbeat_interval'] / 1000
p1=mp.Process(target=heartbeat, args=(heartbeat_interval, ws))
p1.start()
send_json_request(ws, payload)
mainLoop()
except Exception as err:
print(err)
print("Connect failed")
def heartbeat(interval, ws):
print('Attesa')
while True:
time.sleep(interval)
heartbeatJSON={
"op":1,
"d": event
}
try:
send_json_request(ws, heartbeatJSON)
print("Sent json request")
except Exception:
print(traceback.format_exc())
connect()
@tenacity.retry(wait=tenacity.wait_fixed(3))
def connect():
try:
ws.connect('wss://gateway.discord.gg/?v=6&encoding=json')
event = receive_json_request(ws)
heartbeat_interval = event['d']['heartbeat_interval'] / 1000
hb_thread = threading.Thread(target=heartbeat, args=(heartbeat_interval, ws))
hb_thread.start()
send_json_request(ws, payload)
mainLoop()
except Exception as err:
print(err)
print("Connect failed")
print("Joining Heartbeat thread")
hb_thread.join(timeout=1)
def heartbeat(interval, ws):
print('Attesa')
while True:
time.sleep(interval)
heartbeatJSON = {
"op": 1,
"d": event
}
try:
send_json_request(ws, heartbeatJSON)
print("Sent json request")
except Exception:
print(traceback.format_exc())
import string
import time
from threading import Event, Thread
def start():
finisher = Event()
task = Thread(target=repeating_task, args=(finisher,))
task.start()
try:
main()
except EOFError:
finisher.set()
task.join(0.5)
def main():
chars = string.ascii_letters
for char in chars:
print(char, end="")
time.sleep(0.05)
raise EOFError("Finished")
def repeating_task(finish_event: Event):
i = 0
while not finish_event.is_set():
time.sleep(0.1)
i += 1
print(i, end="")
start()
@stable apex do you have a discord api tut that works at a lower level with websockets
I plan on making one eventually but not rn
alright, cheers
hi, how do i switch from anaconda to pip? i'm currently trying to use the pip command to install pd and df packages
anyone know how to split an image into 100 vertical sections
It
depends upon how you load the image
you can use python's Pillow, or straight up use numpy array
in which case splitting up a image across a dimension would be equivalent to splitting up a table
pip is just a distribution system , if the package you want to install is available at pypi then you can just use the command !pip install <packagename>
remember through, it is possible that a package may not be available at both pypi and conda-forge, ( some authors prefer conda-forge)
does this have voice ?
https://stackoverflow.com/questions/5953373/how-to-split-image-into-multiple-pieces-in-python i found this link which has multiple ways of splitting image. not sure which would work for me - can you suggest one code to try. i want to split image into 100 vertical sections and save each section
hello! If i wanted to just delete that in the picture, what would I have to change all the w to? I tried to change all the w to "Canvas(Radda_gubbe,width=1000,height=1000)" but then it just said error.. any help pls. Python tkinter
okay..
# import libraries
import random
from decimal import *
# constants
WIDTH = 5000
HEIGHT = 5000
RADIUS = 5000
# vars
square = 0
circle = 0
for _ in range(2000000):
# choose point
x = random.randint(0, WIDTH)
y = random.randint(0, HEIGHT)
# check if point is in circle
x -= WIDTH
y -= HEIGHT
dist = x ** 2 + y ** 2
if dist < RADIUS ** 2:
circle += 1
square += 1
# calculate pi
pi = 4 * Decimal(circle / square)
print(pi)
@ivory arch what's the problem?
noting wrong particularly, but it only goes up to 3.14
i'd like it to have a few more decimals
@ivory arch why don't use canvas size 1.0
random real number...
get random floating point number
yeah..
It's seems like it should be independent of canvas size... That's what I'm saying...
okay... if you work with pixels you should use int
how many you want...
there are faster way to get pi... if you can use other methods...
geometry 🙃
no, I'm saying you are using geometric way...
For thousands of years, mathematicians were calculating Pi the obvious but numerically inefficient way. Then Newton came along and changed the game. This video is sponsored by Brilliant. The first 314 people to sign up via https://brilliant.org/veritasium get 20% off a yearly subscription.
Happy Pi Day! (for a few days ago...)
References:
Arn...
@ivory arch
You are doing similar to this...
first half of that...
see what newton did
what?
Just watch whole thing.. it's fun
Python implementation of the RANDOM.org API. Contribute to mitchchn/randomapi development by creating an account on GitHub.
https://youtu.be/HEfHFsfGXjs
This would be a fun way to get pi 🙃
Solution: https://youtu.be/jsYwFizhncE
Even prettier solution: https://youtu.be/brU5yLm9DZM
Help fund future projects: https://www.patreon.com/3blue1brown
An equally valuable form of support is to simply share some of the videos.
Special thanks to these supporters: http://3b1b.co/clacks-thanks
New to this channel? It's all about teaching math ...
hey @grave token
hi
want to go into the math server so i can share my screen?
yeah 2 min
watch this @ivory arch and solution in next video... it will be in suggestions..
Even prettier solution: https://youtu.be/brU5yLm9DZM
Help fund future projects: https://www.patreon.com/3blue1brown
An equally valuable form of support is to simply share some of the videos.
Special thanks to these supporters: http://3b1b.co/clacks-thanks
Home page: https://www.3blue1brown.com
Many of you shared solutions, attempts, and simula...
okay bye
You can just use physics formulas
to visualize you should use some physics engine...
okay bye
how can i do so i can choose like text 1 or 2 and choose from there in my python?
hey, can someone pls help with a django thing.
i am trying to add images to the django project but it is not displaying the images
Hey, can someone instruct me how to install matplotlib pakage in python
it says Modulenotfound when I try to import it.
calculating pi using this method
Pi: 3.1395680000, diff: 0.0020246536, time: 1.5
Pi: 3.1410800000, diff: 0.0005126536, time: 3.0
Pi: 3.1411937500, diff: 0.0003989036, time: 11.9
Pi: 3.1413311111, diff: 0.0002615425, time: 13.3
Pi: 3.1413788000, diff: 0.0002138536, time: 14.8
Pi: 3.1414490909, diff: 0.0001435627, time: 16.3
Pi: 3.1414929231, diff: 0.0000997305, time: 19.2
Pi: 3.1415191429, diff: 0.0000735107, time: 20.7
Pi: 3.1415196000, diff: 0.0000730536, time: 22.2
if __name__ == '__main__'
This is a statement that is only true if the module (your source code) it appears in is being run directly, as opposed to being imported into another module. When you run your module, the __name__ special variable is automatically set to the string '__main__'. Conversely, when you import that same module into a different one, and run that, __name__ is instead set to the filename of your module minus the .py extension.
Example
# foo.py
print('spam')
if __name__ == '__main__':
print('eggs')
If you run the above module foo.py directly, both 'spam'and 'eggs' will be printed. Now consider this next example:
# bar.py
import foo
If you run this module named bar.py, it will execute the code in foo.py. First it will print 'spam', and then the if statement will fail, because __name__ will now be the string 'foo'.
Why would I do this?
• Your module is a library, but also has a special case where it can be run directly
• Your module is a library and you want to safeguard it against people running it directly (like what pip does)
• Your module is the main program, but has unit tests and the testing framework works by importing your module, and you want to avoid having your main code run during the test
i have an image and i want python to work out the average pixel intensity below the blue line and average pixel intensity above blue line from image. I know code to work out average pixel intensity of full image. But dont know how to do pixel intensity below blue line and above. IF you have any ideas please help. Or another way is to get python to split image into 2 - one with everything below blue line and other with everything above line then i can do my code. But i dont know how to do that
sorry cant do voice verification yet
Hey @vernal violet!
It looks like you tried to attach file type(s) that we do not allow (.ipynb). 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.
^^we figured this out
Hello all, I am trying to perform invoice data extraction from an image of invoice and export the data into an excel file. But I want to extract only a few fields from the invoice and not the entire invoice. Can anyone please advise how can I do that ?
from PIL import Image # pip install Pillow
set tesseract cmd to the be the path to your tesseract engine executable
(where you installed tesseract from above urls)
and start doing it
your saved images on desktop
list_with_many_images = [
"PartI_Data/Img1.PNG",
"PartI_Data/Img1.PNG",
"PartI_Data/Img1.PNG"
]
create a function that returns the text
def image_to_str(path):
""" return a string from image """
return pytesseract.image_to_string(Image.open(path))
now pure action + csv part
with open("images_content.csv", "w+", encoding="utf-8") as file:
file.write("ImagePath, ImageText")
for image_path in list_with_many_images:
text = image_to_str(image_path)
line = f"{image_path}, {text}\n"
file.write(line)
@stable apex pls turn on your camera
bạn ơi bật cam lên ko cô kick ra khỏi lớp h @stable apex
@light mango https://aka.ms/vs/17/release/vs_BuildTools.exe
!stream 499000870713950238
✅ @light mango can now stream until <t:1647551473:f>.
Actually, it may be simpler than that
Do you or did you have a second monitor on the machine you're remoted to?
Actually huh
It may also be that you're remoted into the machine trying to run the installer
That should give you some error codes to research and hopefully give you an explanation
I wonder if that's because you're trying to run it from a remote connection program
Either way, having to head home now. Keep me posted
But the videos I'm watching that's what they use
al
alr
I think your best bet is going to be going to the computer that you're remoted into and trying it from that one
i cant speak yet in VC but I have a question
✅ @weak zenith can now stream until <t:1647626900:f>.
i'm getting
ah
basically the thing is that I'm trying to run poetry commands in my terminal and it says the specified path is not found and I myself cannot find it in my file explorer so I beleive it's accidentally deleted maybe so I want to completely uninstall it to install again
But I'm not sure how to do it; I've tried some commands which haven't seemed to work
you wanna try just running the installation script from: https://python-poetry.org/docs/#installation
are you connected or still RTCing?
connected
can you hear me?
nope
any kubernetes people here, need help with routing in ingress
!voiceverify
,
how to i get help with my python code ?
i am working on face recognition , using libraries sys, dlib , open cv , skimage
but in pycharm i can't open a window on the desktop showing the image
here is the code i am using :- win.set_image(image)
how can i set the wait time for the image
hello
hello universe
Hi, i want to login to account with firebase_admin. How can i do
I don’t want to use pyrebase because I’m taking error
I once did with pyrebase
I can do it with pyrebase too, but I get an error because I use firebase_admin on my other pages.
!voiceverify
hi
hey
In what?
don't spam to get voice verified, a fair warning
okay😣 💔
!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.
from random import randrange
random_num = randrange(0,101)
print(random_num)
count_guess = 1
oldguess = int(input("Enter the number to guess (0 - 100) : "))
if oldguess not in range(0,101):
print("Out of bounds")
if abs(random_num - oldguess) <= 10:
print('Warm')
else:
print("Cold")
while oldguess != random_num :
guess = int(input("Enter the number to guess (0 - 100) : "))
if abs(guess-random_num) < abs(random_num - oldguess):
print('Warmer')
elif abs(guess-random_num) > abs(random_num - oldguess):
print('Colder')
oldguess = guess
else:
print('Enter a new num')
count_guess += 1
if oldguess == random_num or guess == random_num:
print(
If a player's guess is less than 1 or greater than 100, say "OUT OF BOUNDS"
On a player's first turn, if their guess is
within 10 of the number, return "WARM!"
further than 10 away from the number, return "COLD!"
On all subsequent turns, if a guess is
closer to the number than the previous guess return "WARMER!"
farther from the number than the previous guess, return "COLDER!
!e print(5 in range(10))
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
True
hey 🙂 I know this is not really a code problem more a i am to stupid for this problem but maybe some of you know the answer. I did install open CV (pip install opencv) but when i try to import cv2 its not finding anything
It'll be a case of not having the module not installed into your project environment, I think. You will either need to do that or tweak your IDE settings to do with virtual environments. I don't run into this problem, myself, so I'm not that well versed in how to fix it.
It is a common one, though, so you'll be able to collide with someone who knows.
I'm afraid bots aren't something I'm familiar with.
can u atleast take a look
thats it
What's the bot framework you're using?
what does framework mean
tbh
Something on which you build your project.
I do not.
i got my code from this
Okay, so it uses discord.py.
i think so
I would grab one of the help channels. Someone who does bots is liable to know the common things that can go wrong. It's not a particularly helpful error message.
oh okey
what is this'
hi yall im ben barson
hey my new project is coding a website
cool
yea what should i use flask ?
ok also i wanna host this site
whatever you preffer
for a while its my frien startup project
ummhmm
yea ?
they wanna me have there website up for like a long time is that possible
just keep paying off the hoster
just host on azure or some aws or some
cheap
hosting
ok thanks i hope i can make it soon
goodluck with dat
how can I do this in vim snippets: def 2 -> def {1:myFunc}({2}, {3}):\ n{0} def {num} -> indicates the number of arguments
were you looing to?
@deep echo Thank you it worked ```#THE FRUIT CLASS
class Fruit:
def init(self, type, price):
self.type = type
self.price = price
#def add_to_total (self, total):
#return total + self.price
Apple = Fruit("Apple", 1.75)
class2 = Fruit("Orange", 1.00)
class3 = Fruit("Banana", 0.50)
class4 = Fruit("Grape", 5.00)
class5 = Fruit("Cherry", 3.99)
class6 = Fruit("Peach" ,1.50)
class7 = Fruit("Pear" ,3.00)
fruits = [Apple, class2 ,class3, class4, class5, class6, class7]
for f in fruits:
print (f.price)
print("Welcome to the Marketplace!")
print("Here are the options:")
for curr1 in fruits:
print(curr1.type + "\t\t$", curr1.price)
purchase= []
choice = input("Write the name of the fruit: ")
while(choice != "full"):
purchase.append( str(choice) )
choice = input("Write the name of the fruit: ")
Total = []
fruit_dict = {
"Apple" : 0,
"Orange" : 0,
"Banana" : 0,
"Grape" : 0,
"Cherry" : 0,
"Peach" : 0,
"Pear" : 0,
}
fruit_doct = {
"Apple" : 1.75,
"Orange" : 1.00,
"Banana" : 0.50,
"Grape" : 5.00,
"Cherry" : 3.99,
"Peach" : 1.50,
"Pear" : 3.00,
}
fruit_total = {
1.75,
1.00,
0.50,
5.00,
3.99,
1.50,
3.00,
}
for i in purchase:
fruit_dict[i] += 1
fruit_doct[i]
for i in Total:
fruit_total[i] += i
print("\n", "Your receipt: ")
print("Fruit\t\tQuantity\t\t Price")
for i in fruit_dict:
amount = fruit_dict.get(i)
cocal = fruit_doct.get(i)
if amount > 0 :
print( i , "\t\t", amount, "\t\t\t\t", "$", cocal * amount)
Total.append(cocal*amount)
Exodus= sum(Total)
print("Total", "\t\t\t\t\t\t", "\033[1;31;40m" + "$", str(Exodus)+"\033[0m" )
print("Thank you for coming!")```
anyone on mac ?
coool
yes
chat on my dms it will be easier to communicate
I dmed you
Is there a function that return every object that is colliding with and object in pygame?
still sardii
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
@grave token
@main solar Sure, did :checkhealth
vim-plug?
I dont know what's next, read output of :checkhealth
No, its not a vim plug. its a soc plugin
What's soc?
Uh?
I have never heard of soc? what's that...
Let me look into github issue
go ahead, element
Haha, I have vm
You have node.js? do you?
yep
Ok go ahead.
Going for dinner, ...I'll DM you, brb in 10 min
Sure, cya!
I installed it, showing same for me... I guess you need to config it... @idle basin
Is anyone able to help with some code? thanks in advance
Hi just give me a min
I don't meet the requirements to be voice verified rn
Sry I am new to this server
Yeah
So I am finding it difficult to type out an explanation
Take your time. 🙂
I find it easier to show you the question I am working on above
I simplified my code to the above
And when I test it
This is what I get in comparison to what is expected from my code.
I'm finding I have to read through this several times.
The problem brief as written.
Sorry
It's not your fault.
I'd wish I'd be able to speak rn as it would make it so much easier
People write these things, know what they're talking about, so when they read back through it, they don't see a problem with it.
Even if there is.
So it's left to the reader to interpret.
As opposed to more directly derive.
Do you know what they're talking about when they stress the word "unique"?
Because it seems as though the word needn't exist within this text.
Is there discussion elsewhere that might lend context?
The above is an
excerpt image for an example file provided
When they say unique they refer, focusing on the move title "Charlie and the Talking Buzzard", the actor is not the same person
I don't follow.
There are two instances as shown in the image where Charlie and the Talking Buzzard" is shown with two different/unique actors, "Hanks, Mike" and "Hanks, Christopher"
However in the above, with the movie "The Polar Express", even though it is repeated the most, the actor playing it is the same person "Hanks, Tom"
Making it not unique even thought it has the most indivduals
Oh, so the text file has duplicates that we're throwing away?
Or...merging or whatever.
Deduplicating.
Okay.
Let us all hope, then, that there are no actors, plural, with the same name who have worked on the same movie.
Okay. So read the file. Print the number of people in the movie with the greatest number of people in it, then the name of that movie.
Then print the number of movies in which only one actor appears.
yes
Yes
I would suggest your dictionary have the movie names as its keys and a set of actors as its values.
How would I arrange that?
{"movie name": {"Alex Perfectface", "Peter McSassypants", "Donna Teslahair"},
"other movie name": {"Lonesome Paul"}}```
How would I change my code as my code produces the following:
I am adding a value to the movie based off how many times it appears in the txt
I think I got it
Actually nvm
!e py data = {"Bun Hair": {"Alex Perfectface", "Peter McSassypants", "Donna Teslahair"}, "Murder on the Orient Espresso": {"Lonesome Paul"}} print(len(data["Bun Hair"])) #Number of actors for this movie.
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
3
Okiedoke. 🙂
I was doing it like this
to where I add the actor to the movie key
however
it was considering
each actor
together
I am just having difficult assigning the author's to each movie key since I can't do it manual
so
I am just trying to figure out through the method I shown above
Yeah
I don't see where authors enter into it.
!e print(dir(dict))
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
['__class__', '__class_getitem__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__ior__', '__iter__', '__le__', '__len__', '__lt__', '__ne__', '__new__', '__or__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__ror__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', 'clear', 'copy', 'fromkeys', 'get', 'items', 'keys', 'pop', 'popitem', 'setdefault', 'update', 'values']
!e py my_dict = {"key_a": "value_a", "key_b": "value_b"} print([*my_dict.items()]) print([*my_dict.keys()]) print([*my_dict.values()])
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | [('key_a', 'value_a'), ('key_b', 'value_b')]
002 | ['key_a', 'key_b']
003 | ['value_a', 'value_b']
max
"comprehension"
max's key parameter
lambda function
(doesn't have to be a lambda function, could be a def function)
!e ```py
def func(v):
return 3-v
vs = 1, 2, 3
print(max(vs, key=func))```
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
1
max(vs, key=lambda v: 3-v)```
a = 1
b = 2
c = 93
sum = num1 + num2 + num3
print('The sum of {0} and {1} is {2}'.format(a b c sum))```
!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
a = 1
b = 2
c = 93
sum = num1 + num2 + num3
print('The sum of {0} and {1} is {2}'.format(a b c sum))
@main solar :x: Your eval job has completed with return code 1.
001 | File "<string>", line 8
002 | print('The sum of {0} and {1} is {2}'.format(a b c sum))
003 | ^^^
004 | SyntaxError: invalid syntax. Perhaps you forgot a comma?
a = 1
b = 2
c = 93
sum = a + b + c
print('The sum of {0} and {1} is {2}'.format(a, b, c, sum))```
!e
a = 1
b = 2
c = 93
sum = a + b + c
print('The sum of {0} and {1} is {2}'.format(a, b, c, sum))
@main solar :white_check_mark: Your eval job has completed with return code 0.
The sum of 1 and 2 is 93
@main solarHello. I'm presently engaged in assisting another user at this time. If you require assistance at this time, I would suggest you use the help channel system. #❓|how-to-get-help . Otherwise, I'll endeavour to get back to you when I can. 🙂
!e py my_dict = {"apples": 1, "pears": 2, "grapes": 3} print(max(my_dict)) #The iterable are the *keys* for this purpose print(max(my_dict, key=my_dict.__getitem__))
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | pears
002 | grapes
!e py my_dict = {"key": "value"} print(my_dict["key"]) print(my_dict.__getitem__("key"))
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | value
002 | value
key=lambda a: my_dict[a]```
def func(a):
return my_dict[a]```
a being the key
!e ```py
my_list = []
for i in range(5):
my_list.append(i)
print(my_list)
my_list = [i for i in range(5)] #new my_list
print(my_list)```
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | [0, 1, 2, 3, 4]
002 | [0, 1, 2, 3, 4]
!e ```py
my_list = []
for a in "abc":
for b in (1,2,3):
my_list.append((a,b))
print(my_list)
my_list = [(a,b) for a in "abc" for b in (1,2,3)]
print(my_list)```
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | [('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3), ('c', 1), ('c', 2), ('c', 3)]
002 | [('a', 1), ('a', 2), ('a', 3), ('b', 1), ('b', 2), ('b', 3), ('c', 1), ('c', 2), ('c', 3)]
!e py a = 1, 2, 3 print(max(a)) print(max(v for v in a))
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | 3
002 | 3
!e py vs = True, True, True, False, True print(sum(vs))
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
4
!e py d = {"a": {"b", "c"}, "d": {"e"}} print(d.values()) print(max(len(v) for v in d.values()))
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | dict_values([{'c', 'b'}, {'e'}])
002 | 2
@main solar I'm available now. Do you require assistance at this time?
Okay, we'll, I'll be around for a bit. Come find me if you need me. Ideally, go through the help channel system, though.
hey is anyone here?
hi
I was working on an program that took in a tuple (x,y) and returned a tuple that'll get closer to another point in increments
but I'm getting index errors
let me put my code into a replit file so I can send in chat
https://replit.com/@AnthonyNguyen59/MoveToPoints2#main.py. don't know if this'll work
ah It did
im srry i cant really help i recently started cofing and to be honest i barley understand anything and i wasnt really understanding yt so i came hertr to se if i can get some help, again rlly srry i cat help u with this 😦
oh alright
yeh sorry
Nah it's alright
if u dont mind me asking what r u making?
I figured it out. It dumb haha
I mean my mistake
have any of yall used a hand tracking library such as mediapipe or tesorflow?
!e sayi1 = input('1. Sayı : ')
sayi2 = input('1. Sayı : ')
toplam=float(sayi1)+float(sayi2)
print("Toplam :{0} ".format(toplam))
@native crescent :x: Your eval job has completed with return code 1.
001 | 1. Sayı : Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
huh
def init(self, tokens): @main solar
thanks
I was making code to switch sprite surfaces if the user clicks their mouse. But I'm getting a type error.
if mouseButton[0]:
mouseButton = False
timePoint = pygame.time.get_ticks()
if timePoint < 2000:
self.perrySurf = self.perryActive
if mouseButton[0] == False or timePoint < 2000:
self.perrySurf = self.perryDefault
timePoint = 0
The error is
TypeError: 'bool' object is not subscriptable
line 1... you are using it as list
yes...
mouseButton = pygame.mouse.get_pressed()
i forgot about this
this is how I delcared it
it's a list of bool
TOSS A COIN TO THIS WITCHER 🙃
Thanks man I've been working for hours and just needed a fresh set of eyes
np
@worn ruin is there a reason you're posting these?
anyone able to help me real quick I think my problem is pretty basic
im going to explode
Hello @ancient pagoda
We're chatting in #help-bread if you're wondering what's going on.
Hi
Hey @tulip fossil
See above 
Erm, I'm currently helping someone sorry.
You could ask the people in #751591688538947646 maybe?
Hello i am trying to align the password entry (tkinter module) with the email and website entries i used .grid(column=1) for all of them but i didn't work. if anyone can help me with that
!e py from collections import defaultdict a = defaultdict() b = dict(a) print(type(a)) print(type(b))
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | <class 'collections.defaultdict'>
002 | <class 'dict'>
@worldly sky
In order to know why you aren't seeing what you want to be seeing, an examination of your code is in order.
Posting here because I don't have !e privs in the general room.
can someone help me debug my code, it is an indentation error but i keep trying to fix it but it just wont work
https://replit.com/@SamieAlswafta/UsernameAndPassword
the indentation is like lines 130 - 136
i keep on getting an indentation error
and when i get rid of it
it says main isnt defined
!voiceverify
If anyone can help me with my code I would really appreciate it thank you
what do you need help with ?
I have a question posted in #help-cherries @lime spruce
If you can't see it I can copy and paste it here
Yeah do that
hello, i am trying to use some code I found on github
i am not sure how it works
do I just put the file path here?
please ping if you know what to do
Hey guys Can anyone help me identify the number of operands in a source code by hand?
public class Deneme {
public int x;
public int y;
public Deneme(int x, int y) {
this.x = x;
this.y = y;
}
public int x2y2() {
return x * x + y * y;
}
public double Squareroot() {
return Math.sqrt((double) x2y2());
}
public double log2() {
++y;
return Math.log(((double) x) / y);
}
@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof Deneme) {
return ((Deneme) obj).x == this.x && ((Deneme) obj).y == this.y;
}
return false;
}
}
Is this Python ?
could anyone with django and htmx experience please help
voice chat!!
What do you need help with ?
friend?
add you as friend
?
I don't add people as friends if they invite me to any group dm
or rather, I unfriend them in that case
read this
we can still chat and call and all that but we don't need to be discor friends
there's a thing you can toggle
idk where
probably in voice & video settings
busy rn
busy playing minecraft
duh
I put it on do not disturb cuz my other friends spam me
also why are talking in the python discord
shd be on already
:ok_hand: applied mute to @main solar until <t:1648995922:f> (9 minutes and 59 seconds) (reason: duplicates rule: sent 4 duplicated messages in 10s).
import random
print('Hello,i am talkbot')
print('my commands are:')
print('1.hello 2 whats your name 3.do you hate me 4.you are boring5.hi 6.i am getting dull 7.flip a coin')
while(2>1):
msg1=input("Enter the message ")
if(msg1=='hello' or msg1=='Hello'):
print('hi')
elif(msg1=='whats your name' or msg1=='Whats your name'):
print('I am talkbot')
elif(msg1=='do you hate me' or msg1=='Do you hate me'):
print('Of course no')
elif(msg1=='you are boring' or msg1=='You are boring'):
print('I am sad to know that')
elif(msg1=='hi' or msg1=='Hi'):
print('Hello, nice to meet you')
elif(msg1=='i am getting dull' or msg1=='I am getting dull'):
print('BOOM!!! Are you dull now ?')
elif(msg1=='flip a coin' or msg1=='Flip a coin'):
coin=(random.randint(0,1))
if (coin==0):
print('Heads')
elif (coin==1):
print('Tails')
else :print ('FAIL')
else:
print("i don't know that")
the coin flipping part is not working
the session just crashes
without any error messages
im currently trying to do a music function with my bot, but im having trouble with this error, and have had the error and have been trying to tackle it for what feels like forever now lmao
Command it's failing on: ```py
@bot.command()
async def play(ctx, url : str):
song_there = os.path.isfile("song.mp3")
try:
if song_there:
os.remove("song.mp3")
except PermissionError:
await ctx.send("Wait for the current playing music to end or use the stop command, you sexy mf.")
return
voiceChannel = discord.utils.get(ctx.guild.voice_channels, name='General')
await voiceChannel.connect()
voice = discord.utils.get(bot.voice_clients, guild=ctx.guild)
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key': 'FFmpegExtractAudio',
'preferredcodec': 'mp3',
'preferredquality': '192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
for file in os.listdir("./"):
if file.endswith(".mp3"):
os.rename(file, "song.mp3")
voice.play(discord.FFmpegPCMAudio("song.mp3"))
Getting the error on the line:py
ydl.download([url])
Error: `unable to obtain file audio codec with ffprobe`
hey guys, i am kind of new to python, i know basic python knowledge, i have beed making a python gmae on pygame and the code just wont run for no apparent reason
if anyone is willing to help pls dm me
i cant really paste code into the section so pls dm me
.
hi guys I am trying to collect the total by using fruitful function can you help me, please
food =["Burger","Drink","Fries","Apple Pie"]
prices = [5,1,3,2]
myorderFood=[]
myorderCost=[]
counter=0
print ("Welcome to SATO Restaurant")
order = input("Can I take your order?")
def total():
a=prices [0]+prices [1]+prices [2]+prices [3]
return a
def mune():
print("Choose from the menu")
print("Burger,Drink,Fries,Apple Pie")
mune()
nextorder = True
while nextorder==True:
foodorder=input("Please enter item")
if foodorder=="Burger":
myorderFood.append ( food [0])
myorderCost.append (prices [0])
counter=counter+1
elif foodorder=="Drink":
myorderFood.append (food [1])
myorderCost.append (prices [1])
counter=counter+1
elif foodorder=="Fries":
myorderFood.append ( food [2])
myorderCost.append (prices [2])
counter=counter+1
elif foodorder=="Apple Pie":
myorderFood.append (food [3])
myorderCost.append (prices [3])
counter=counter+1
else:
print ("Not on menu")
finished=input("Have you finished ordering Y/N")
if finished=="N":
nextorder=True
else:
nextorder=False
y=0
print ("Here is your order")
print (" ")
print ("********************************************************")
while y<counter:
print ("Item: "+ (myorderFood [y]))
print ("Cost: ",(myorderCost [y]))
y=y+1
print ("The final cost is : ",(total()))
print("=========================================================")
Hi guys do you know if people can access online to my program on replit because it is public ?
I think they can
yeah ok thanks for your reply, I have just put my token for my bot in an environment variable I heard it is safe when we do it
I'd reset it, just to be safe
yeah you did well
you coded it on replit as well ?
.
:incoming_envelope: :ok_hand: applied mute to @unkempt grail until <t:1649280786:f> (9 minutes and 59 seconds) (reason: mentions rule: sent 7 mentions in 10s).
what roles should I have ? to share the screen
the video role
but it's given my mods/admins
so no
what is that?? Did you butcher python?
its Visual Studio Code Python externios
python doesen't need '{' or '}' or '(' or ')' like you used them
a : int = 0
print("buna kac puan verdiniz?")
a : int = int(input())
if a < 5:
print("Smaller than 5")
## I don't understand what your intention is with the 'input()'
else:
print("Not smaller than 5")
and you should check if the input is actually an int before calling 'int(input())'
@livid basalt
#include <stdio.h>
#include <stdlib.h>
//#include "Sorter.h"
/**
* Sorting Algorithms in C
* (algorithms are found in Sorter.h)
*/
void swapVal(void *a, void *b, size_t siz)
{
char temp[siz];
memcpy(temp, b, siz);
memcpy(b, a, siz);
memcpy(a, temp, siz);
}
// Bubble sort
void bubbleSort(void *base, size_t nitems, size_t siz, int (*cmp)(const void*, const void*))
{
for (size_t i = 1; i < nitems; i++)
{
for (size_t j = 0; j < nitems - i; j++)
{
if ((*cmp)((void*)(base+j), (void*)(base+j + 1))) // Something is wrong here
{
swapVal((void*)(base+j), (void*)(base+j + 1),siz);
}
}
}
}
int cmpfunc (const void * a, const void * b) {
return ( *(int*)a - *(int*)b );
}
int main(void)
{
int toSort[] = {1,2,3,4,9,8,7,6,5};
puts("Before sorting:");
for (int i = 0; i < 9; i++)
{
printf("%d ", toSort[i]);
}
bubbleSort(toSort, 9, sizeof(int), cmpfunc);
puts("After sorting:");
for (int i = 0; i < 9; i++)
{
printf("%d ", toSort[i]);
}
return 0;
}
!e ```py
class MyClass:
def init(self):
self._data = 0
@property
def data(self):
print("Get!")
return self._data
@data.setter
def data(self, v):
print("Set!")
self._data = v
mc = MyClass()
print(mc.data)
mc.data = 1
print(mc.data)```
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | Get!
002 | 0
003 | Set!
004 | Get!
005 | 1
!e ```py
class MyClass:
def init(self):
self._data = 0
def data_get(self):
print("Get!")
return self._data
def data_set(self, v):
print("Set!")
self._data = v
mc = MyClass()
print(mc.data_get())
mc.data_set(1)
print(mc.data_get())```
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | Get!
002 | 0
003 | Set!
004 | Get!
005 | 1
class MyClass:
v = 0```
!e ```py
class MyClass:
v = 0
def get(self):
return self.v
mca = MyClass()
mcb = MyClass()
print(mca.get())
mcb.v = 5
print(mca.get())```
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | 0
002 | 0
!e ```py
class MyClass:
def init(self, v):
self.v = v
mc = MyClass(6) #Right of the = is the constructor of a class. The "call" of a class. init is also referred to as the constructor of a class.```
@amber epoch :warning: Your eval job has completed with return code 0.
[No output]
!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.
` vs '
```py
my_code_here
```
def __init__(self, car):
self.car = car
self.cat = cat
!e
class A:
def __init__(self, a):
self.a = a
def print(self):
print(self.b)
o = A(5)
o.b = 7
o.print()
@vague rune :white_check_mark: Your eval job has completed with return code 0.
7
!e ```py
class MyClass:
def method_or_function(self):
print(self)
mc = MyClass()
print(f"Before instantiation: {type(MyClass.method_or_function)}")
print(f"After instantiation: {type(mc.method_or_function)}")
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | Before instantiation: <class 'function'>
002 | After instantiation: <class 'method'>
!e ```py
class MyClass:
def method_or_function(self):
print(self)
MyClass.method_or_function("Apple")
mc = MyClass()
mc.method_or_function()```
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
001 | Apple
002 | <__main__.MyClass object at 0x7ff6410d5b40>
!e
class A:
def __init__(self, a):
self.a = a
def print(self):
print(self.a)
lst = [A(1), A(2), A(3), A(4)]
list(map(A.print, lst))
@vague rune :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 2
003 | 3
004 | 4
IDEs
spyDE
help?
with js?
setPersons(persons.slice(0,-2))
}
Why does this code slice off the last two list elements the first time I click, and then the last 1 element for subsequent clicks. React JS
I am new to Python and I need some Help!
def checkPal(s) -> bool:
if len(s) == 1:
print("Returned")
return True
if s[0] == s[-1]:
print('Checking')
checkPal(s[1:-1])
else: return False
print(checkPal('madam'))
What's wrong with this code?
hello, any one free to help me ?
in what ?
Hey i dont know if this is something to do with python but im trying to get data from an api and save it as a json file.
I can save it but its this really long string thats in one line.
Is there any way to seperate it like ive done right here manually.
{"suggestions": [
{"id": "90707431",
"prod_id": "85465",
"title": "Finvalsede havregryn",
"description": "Finvalsede havregryn",
"img": "https://image.prod.iposeninfra.com/bilkaimg.php?pid=85465&imgType=jpeg",
"link": "https://www.bilkatogo.dk/p/85465",
"price": 9.95},
{"id": "32861601",
"prod_id": "39411",
"title": "Finvalsede havregryn \u00f8ko",
"description": "Finvalsede havregryn \u00f8ko",
"img": "https://image.prod.iposeninfra.com/bilkaimg.php?pid=39411&imgType=jpeg",
"link": "https://www.bilkatogo.dk/p/39411", "price": 8.96},
{"id": "90707441",
"prod_id": "85466",
"title": "Grovvalsede havregryn",
"description": "Grovvalsede havregryn",
"img": "https://image.prod.iposeninfra.com/bilkaimg.php?pid=85466&imgType=jpeg",
"link": "https://www.bilkatogo.dk/p/85466",
"price": 11.5},
]}
Can i do it when i get it from the api or do i make another script?
your function call isn't being returned.
I believe there's a function called write pretty that will prettify before writing the file.
No, it's called json.dump(). Here, use this :
with open(fn, "w") as write_file:
json.dump(j, write_file, indent=2)```
I believe the optional indent parameter is what causes the function to prettify.
@earnest harness
Hey guys, I need a simple algorithm, that given a deck of cards (for example, user input would be - 4,2,king,9,queen) will sort it ascending values, can anyone do that for me real quick?
@earnest harness did your issue get fixed?
What's happening in the voice channel
there is no switch statement for python is there>
!voice
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
Voice verification
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
okay
yes
my issue is im making a hash script file checker
import hashlib
import datetime
import json
print("Welcome to the super dick script")
userContinue = True
while userContinue:
file_path = input('Enter the full path of the file to check (example: C:/test.txt) or [e] to exit: ')
if file_path.lower() == "e":
print("Bye!")
break
try:
file_to_check = open(file_path,"rb")
sha256_hash = hashlib.sha256(file_to_check.read()).hexdigest()
time_stamp = str(datetime.datetime.now())
print("time_stamp:",time_stamp,"file:",file_path,"hash:",sha256_hash)
except Exception as error:
print("error", error)
this works
i have to do this as added extras -
oad the log file containing previous hash checks in read mode - #file.open and load data like json
ead the contents of that file using JSON and store it into a list called logs[] #wstore into list
Close the file #
Add the new time_stamp, file and hash to the list as a dictionary #
Loop through the list and print any hash and time stamp for that same file #like searching in lab 5 but by file name
Append the new hash, time stamp and file name to the existing list #
Open the log file in write mode #
Dump the list of the old hash and the new hash to the log file using JSON
Close the file
Begin main loop
while userContinue:
# Ask the user for the file path
file_path = input('Enter the full path of the file to check (example: C:/test.txt) or [e] to exit: ')
# Check for exit press
if file_path.lower() == "e":
print("Bye!")
break
with open(file_path):
json.load(data.log)
print(data.log)
!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.
ah
thanks i didnt know
while userContinue:
# Ask the user for the file path
file_path = input('Enter the full path of the file to check (example: C:/test.txt) or [e] to exit: ')
# Check for exit press
if file_path.lower() == "e":
print("Bye!")
break
with open(file_path):
json.load(data.log)
print(data.log) ```
the - with open(file_path):
with open(file_path) as f:
json.load(f)
ah okay
im getting other errors
raw decode errors
Im new to all this and have had this assignment placed on me :/
C:\users\Nibbler\Documents\friends.json
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
my ide is frozen
atom
data.append({key:value, key,value})
log = []
log.append(time_stamp + file_path + sha256_hash)
log.append(data)
i have this as well
which i was provided by the professor
which should work
but I cant find much on key values
any rec resources?
it seems more like a pseudo code
nah the file wont open i think i might leave it and try tomorrow
maybe i can VC tomorrow
thank you for your help
ah yesterday i think
or the day before
oh
😦
ill wait
i have to wait
thank you for your help
what is it
can someone Help on #help-carrot
can someone help me im a beginner in coding
Guys... I have a dataframe which it contains lots of Lat and Lon values. What I want to do is simply finding the nearest of point(s) for like 5 points maybe depending on my variables.
newlat = 40.1
newlon = 22.1
c = ds.sel(lat=newlat, lon=newlon, method="nearest")
this is working with xarray but that gives me only one value
how can i find more nearest points?
is there a place where i can find some answers?
hey can someone help me I got a problem I launched my website everything works fine but the background image on ios looks so zoomed in but it is just on ios nothing else
it works just fine on windows mac and chrome but not in ios
im on
just find myself couldn't use the voice channel
Is that okay for me
to just send
50 messages to this channel?
Or I will have to split it for like several days?
is there anyone who can help me with my code in VC?
Can someone please help me, im trying to make the leap into Python I hear its the most reliable lang. to learn.. can any season vet translate this simple automation into Python.py so I can get an idea how to kick start this journey I'll really appreciate it thanks.
^s::
sleep 2
loop ,
{
sleep 15
CoordMode, Mouse, Screen
MouseMove, 35, 693, ; Copy # from list from terminal.
send { left down 20 }
send {left up}
MouseClick, left
MouseClick, left
sleep 2000
send ^c
MouseClick, right
sleep 1000
MouseMove, 784, 206, ; Move to location to paste.
MouseClickDrag, right, 784, 206, 785, 209
send ^v
sleep 2000
send ^x
}
send % A_LoopField
Someone in help lemon could help me please?
yeah
106
wait
i can explain you my issues
if you use variable = [4,5,6,-10,-12,5,4,6]
the results must be between 0 and 10
how could you do that?
no man it doesn work wait
you need to check that for every element i mean
4+5 is ok
but 9 + 6 it exceed 10
how to clip that
@echo urchin
no man you didnt understand my question ahah
the first sum is ok but the second it is not ok because it exceed 10
i dont want to sum only the number between 0 and 10
by writing is quite difficult but I try
I need to sum every element and the sum mustnt exceed a value. the sum of every element
is there a way to speak? I can explain what doesnt work ahah. Im ok with the basics of programming
@fading thicket can't you give him the permissions?
.
You're a moderator, you must be able to do that.
by having this variable = [4,5,6,-10,-12,5,4,6]
I want to keep it between 0 and 10
the result must be
[9,10,0,0,5,9,10]
Im sorry but by writing it is difficult to explain in a good way
im sorry
Whatever the elements are, the result must always be between between 0 and 10....
Correct?
yes
So, If there are 10 elements inside a list, the sum must be between 0 and 10?
No matter how many variables there are?
yeah that's correct
.
Okay.
the value inside the array
i want to keep them between 0 and 10
nono
the sum must be everytime between 0 and 10
is it clear?
I can make another example
The model that @echo urchin
please
has made is correct.
Starting with [3,3,3,3,3,3,-4,-4,-4,-4,-4,3,3,3,3,3] in the end the final array must be [3,6,9,10,10,10,6,2,0,0,0,3,6,9,10,10]
is it more clear now?
so i need to create a new list with a for loop and adding every value in here with an if statement right?
old_list = [3,3,3,3,3,3,-4,-4,-4,-4,-4,3,3,3,3,3]
new_list = []
current_total = 0
# iterate through old_list
# Add the current element to the current_total
# Check if the current_total is outside of our bounds
# Add the current_total to the new_list
print(new_list)
now I try and i let you know if it works
thank you so much
yeah
im coding
wait a second
cap = 20
total = 0
for i in diff:
total = diff[i]
if(total <= cap):
en_battery[i] = total
print(en_battery)
plt.plot(en_battery)
```py
code
```
diff = [3,3,3,3,3,3,-4,-4,-4,-4,-4,3,3,3,3,3]
en_battery = []
cap = 20
total = 0
for i in diff:
total = diff[i]
if(total <= cap):
en_battery[i] = total
print(en_battery)
plt.plot(en_battery)
Dammit, I started with C# for Unity.
ah yeah you are right!
!e
diff = [3,3,3,3,3,3,-4,-4,-4,-4,-4,3,3,3,3,3]
en_battery = []
cap = 20
total = 0
for i in diff:
total = i
if(total <= cap):
en_battery.append(i)
print(en_battery)
@fading thicket :white_check_mark: Your eval job has completed with return code 0.
[3, 3, 3, 3, 3, 3, -4, -4, -4, -4, -4, 3, 3, 3, 3, 3]
if the list diff is with float value?
the variable total should be float right?
also the final array
thank you so much bro
really appreciated
# iterate through old_list
# Add the current element to the current_total
# Check if the current_total is outside of our bounds
# Add the current_total to the new_list
I was expecting that using array.sum() could have worked with some if statements but it didnt work
by using your code it works
starting from C code Im finding some issues
in python you have a lot of functions that can make easier you code
no I have only this .py
could i ask you a final question?
ye
Griff are you a moderator? is it possible to speak for a moment to explain you a thing?
if not I ll write it here
@fading thicket
@fading thicket , what software are you using to code?
@fading thicket is it possible to speak for a moment to explain you a thing?
Okay, found it.
ah okok no problem, I explain you here
Isn't it DataLore?
diff in my code is probably a dataframe, im not sure
cya
Have a great day everybody!
I downloaded from a csv file some data, I have a float value and also a time period, so probably the code that I show you before doesnt work
cya!
it is because when I plot "diff" I have the time on x axis, by plotting your code on the x axis I have the position in the array
Instead of using an array, how could I use an dataframe?
@fading thicket Thank you so much for your time!!
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
streammmm
@fading thicket @void badge what's the problem?
Sorry hold on
it's coding dealing with
posets and hasse diagrams
cosets?
ah partially ordered set!
what's the problem?
@void badge
They seem like a directed acyclic graph!
make sense it's a dag!
@fading thicket what's the problem?
def new_word(my_word, word_bank, used):
""""
Returns a tuple containing the old word and the new word that can be
formed from the old word and the remaining tiles in the pile. This tuple
must not be in used. Function updates the used list appropriately. If there
is no unused tuple to return, return None.
Arguments:
- my_word [str]: the word to be added to
- word_bank [list]: a list of valid words that can be considered
- used [list]: a list of tuples that have already been made
"""
available_words = filter(lambda e: e not in [u[1] for u in used], word_bank)
possible_next_words = filter(lambda e: len(e) == len(my_word) + 1, available_words)
# Filter to words that are 1 char away
for word in possible_next_words:
output = (my_word, word)
used.append(output)
return output
def generate_games(my_word, word_bank, used, poset):
"""" Recursively generates a poset of the possible games.
Arguments:
- my_word [str]: the word to be added to
- word_bank [list]: a list of valid words that can be considered
- used [list]: a list of tuples that have already been made
- poset [list]: a list of tuples representing the poset so far
"""
while True:
next_word = new_word(my_word, word_bank, used)
if next_word is None:
break
poset.append(next_word)
generate_games(next_word[1], word_bank, used.copy(), poset)
@void badge
Test #1: PASSED!
Correct Answer: [('a', 'at'), ('at', 'cat'), ('cat', 'cats'), ('cats', 'scats'), ('cat', 'scat'), ('scat', 'scats')]
Your Answer: [('a', 'at'), ('at', 'cat'), ('cat', 'cats'), ('cats', 'scats'), ('cat', 'scat'), ('scat', 'scats')]
Test #2: PASSED!
Correct Answer: [('a', 'ta'), ('ta', 'tav'), ('tav', 'tave'), ('tave', 'taver'), ('taver', 'tavern'), ('tavern', 'taverns')]
Your Answer: [('a', 'ta'), ('ta', 'tav'), ('tav', 'tave'), ('tave', 'taver'), ('taver', 'tavern'), ('tavern', 'taverns')]
Test #3: FAILED!
Correct Answer: [('a', 'ha'), ('ha', 'hah'), ('hah', 'haha'), ('haha', 'hahah'), ('hah', 'ahah'), ('ahah', 'hahah'), ('ha', 'aha'), ('aha', 'haha'), ('aha', 'ahah'), ('a', 'ah'), ('ah', 'hah'), ('ah', 'aha')]
Your Answer: [('a', 'ha'), ('ha', 'hah'), ('hah', 'haha'), ('haha', 'hahah'), ('hah', 'ahah'), ('ahah', 'hahah'), ('ha', 'aha'), ('aha', 'haha'), ('haha', 'hahah'), ('aha', 'ahah'), ('ahah', 'hahah'), ('a', 'ah'), ('ah', 'hah'), ('hah', 'haha'), ('haha', 'hahah'), ('hah', 'ahah'), ('ahah', 'hahah'), ('ah', 'aha'), ('aha', 'haha'), ('haha', 'hahah'), ('aha', 'ahah'), ('ahah', 'hahah')]
na rotisw poio python prepei na katevaso gia na kanw custob bot
`import pywhatkit
Send a WhatsApp Message to a Contact at 1:30 PM
pywhatkit.sendwhatmsg("+10121210102102", "Hi", 13, 30)`
how can i use a variable instead of writing the time manually i tried using:
time = "13,30" pywhatkit.sendwhatmsg("+10121210102102", "Hi", time)
and that one did not work
i tried using an array too and it was negative
time = (13, 30)
pywhatkit.sendwhatmsg("+10121210102102", "Hi", *time)
pywhatkit.sendwhatmsg("+10121210102102", "Hi", time)
pywhatkit.sendwhatmsg("+10121210102102", "Hi", (13, 30))
pywhatkit.sendwhatmsg("+10121210102102", "Hi", 13, 30) # This is what you want
!e ```py
print("hello", "world", "lol")
@toxic walrus :white_check_mark: Your eval job has completed with return code 0.
hello world lol
!e ```py
msg = "hello"
print(*msg)
@toxic walrus :white_check_mark: Your eval job has completed with return code 0.
h e l l o
!e ```py
msg = "hello"
print("h", "e", "l", "l", "o")
@toxic walrus :white_check_mark: Your eval job has completed with return code 0.
h e l l o
print("hello world")
@wary adder :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 'gdgd' is not defined
hello
can someone unmute me?
@cunning atlas
@wanton phoenix
I need help with a python assignment'
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
def a(): pass
def b():
a()
def c():
b()
c()
# a.py
def fn_a(): pass
# b.py
from a import fn_a
def fn_b():
fn_a()
# c.py
## Another way to import
import b
def fn_c():
b.fn_b()
# main.py
import c
c.fn_c()
can someone help me with an issue i have with python?
Yes
Epoch 1/50
ValueError Traceback (most recent call last)
d:\Yazılım\Deep Learning\Giriş 1\DeepLearning1.ipynb Cell 8' in <cell line: 1>()
----> 1 madel_run = model.fit(train_images, train_labels, epochs = 50, validation_data=(test_images, test_labels))
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\utils\traceback_utils.py:67, in filter_traceback.<locals>.error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.traceback)
---> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\tensorflow\python\framework\func_graph.py:1147, in func_graph_from_py_func.<locals>.autograph_handler(*args, **kwargs)
1145 except Exception as e: # pylint:disable=broad-except
1146 if hasattr(e, "ag_error_metadata"):
-> 1147 raise e.ag_error_metadata.to_exception(e)
1148 else:
1149 raise
ValueError: in user code:
File "C:\Users\Big Chief\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\engine\training.py", line 1021, in train_function *
return step_function(self, iterator)
File "C:\Users\Big Chief\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\engine\training.py", line 1010, in step_function **
outputs = model.distribute_strategy.run(run_step, args=(data,))
File "C:\Users\Big Chief\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\engine\training.py", line 1000, in run_step **
outputs = model.train_step(data)
File "C:\Users\Big Chief\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\engine\training.py", line 859, in train_step
y_pred = self(x, training=True)
File "C:\Users\Big Chief\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\Big Chief\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\engine\input_spec.py", line 264, in assert_input_compatibility
raise ValueError(f'Input {input_index} of layer "{layer_name}" is '
ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 28, 28), found shape=(32, 784)
help me
Hey @pallid fog!
It looks like you tried to attach file type(s) that we do not allow (.ipynb). 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.
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
df.iloc[:] = a
can anyone help me with code
@cold plume
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
@split nimbus
def calcAverage(list_of_scores):
pass
[1, 2, 3, 4, 5]
[90, 80, 70, 55, 76]
[90, 91, 87, 73, 85]
reeeeeee
what is this❓
yes?
Bar_Generator(Hours_Left,Hour_Box,(255,255,0),(765 + 16*i),95,12,25)```
def Bar_Generator(Bars,Bar_Meter,color,x,y,width,height):
Bar_Meter = []
for i in range (1,Bars+1):
Bar_Meter.append(i-1)
print(Bar_Meter)
for i in Bar_Meter:
pygame.draw.rect(screen,color,[x,y,width,height])
!e py result = [*range(10)] #list(range(10)) print(result)
@amber epoch :white_check_mark: Your eval job has completed with return code 0.
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
def Bar_Generator(bars, bar_meter, color, spacing, x, y, width, height):
bar_meter.append(*range(bars))
print(bar_meter)
for i in bar_meter:
pygame.draw.rect(screen, color, [x + spacing * i, y, width, height])
``` ```py
Bar_Generator(Hours_Left,Hour_Box,(255,255,0),16,765,95,12,25)
like , i get that it can help with the first thing
but doesn't solve the issue, i think
You'd just do for i in range(bars): for your second loop and that's all you'd need. You wouldn't need the first stuff.
Though the second loop stuff would still require amendment.
Possibly along the lines of Toxic's.
!e ```py
def Bar_Generator(bars):
x = 5
spacing = 16
bar_meter = [*range(bars)]
print(bar_meter)
print([x + spacing * i for i in bar_meter])
Bar_Generator(10)
@thorny reef :white_check_mark: Your eval job has completed with return code 0.
001 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
002 | [5, 21, 37, 53, 69, 85, 101, 117, 133, 149]
source_dictionaries = ['all', 'ahd-5', 'century', 'wiktionary', 'webster', 'wordnet']
if anyone has time this weekend I was wondering if i could go through leetcode questions and meta prep questions
i plan on applying to jobs soon
and was hoping someone could help me along some questions in voice
is this server actually helpful for learning how to code?
Why do we get "ValueError: source code string cannot contain null bytes"?
:incoming_envelope: :ok_hand: applied mute to @main solar until <t:1650910504:f> (9 minutes and 59 seconds) (reason: newlines rule: sent 101 newlines in 10s).
!unmute 312184956942155776
:incoming_envelope: :ok_hand: pardoned infraction mute for @main solar.
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
for i, (key, value) in enumerate(colors):
c =Radiobutton(stephen,text=key,value=value,variable=choose)
c.place(x = 12,y=i*8)
Hi
couild i join vc for help?
vc help
if anyone wants to go through leetcode problems with me
in cod/help
that would be great
how do i get streaming permissions?
You'd need to ask a mod to give you streaming permissions
how do i replace "and {any capital letter}" with ". {Same capital letter}" using regex
How can i make my product monitor check if the product status has changed since it was last checked? ie if it goes instock, it will check if it was instock on the previous check, and if not send a discord webhook, but if it was instock it wont?
!stream 231588869609488384
✅ @pallid ice can now stream until <t:1651244951:f>.
!e
def bark(): print("Woof Woof!") print("Im a Dog")for x in range(1): bark()def hello(): print("Hello Nick") print("Hello Wilson") print("Hows your Day going?") print("Wonderful so far today") print("You going to workout this afternoon?") print("No, Got to pick up my daughter from the baby sitters this afternoon and do some Mowing")for x in range(1): hello()print(hello)
@pallid ice :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | def bark(): print("Woof Woof!") print("Im a Dog")for x in range(1): bark()def hello(): print("Hello Nick") print("Hello Wilson") print("Hows your Day going?") print("Wonderful so far today") print("You going to workout this afternoon?") print("No, Got to pick up my daughter from the baby sitters this afternoon and do some Mowing")for x in range(1): hello()print(hello)
003 | ^^^^^
004 | SyntaxError: invalid syntax
!e
def bark():
print("Woof Woof!")
print("Im a Dog")
for x in range(1):
bark()
def hello():
print("Hello Nick")
print("Hello Wilson")
print("Hows your Day going?")
print("Wonderful so far today")
print("You going to workout this afternoon?")
print("No, Got to pick up my daughter from the baby sitters this afternoon and do some Mowing")
for x in range(1):
hello()
print(hello)
@pallid ice :white_check_mark: Your eval job has completed with return code 0.
001 | Woof Woof!
002 | Im a Dog
003 | Hello Nick
004 | Hello Wilson
005 | Hows your Day going?
006 | Wonderful so far today
007 | You going to workout this afternoon?
008 | No, Got to pick up my daughter from the baby sitters this afternoon and do some Mowing
009 | <function hello at 0x7f747a6a8ca0>
def bark():
print("Woof Woof!")
print("Im a Dog")
for x in range(1):
bark()
def hello():
print("Hello Nick")
print("Hello Wilson")
print("Hows your Day going?")
print("Wonderful so far today")
print("You going to workout this afternoon?")
print("No, Got to pick up my daughter from the baby sitters this afternoon and do some Mowing")
for x in range(1):
hello()
print(hello)
So this may be alot more complicated than im thinking it would be but how can i make my code uhm Something and not just printed out in my terminal?? Im very new to this like 3 days and the course i just finished had me build a guessing game.... So i would just like to be able to put it on something hell anything lol
I know there are probably a billion of these out there i just want to show a small grp of my friends its some cool things IMO
@idle dome What does this wrap it in if you dont mind me asking??
!e
code
!invite
reverse(string)
Hey is hecky here???
for x in array:
^
SyntaxError: Unexpected identifier
y = 0
for x in array:
y += x
if array == []:
return 0;
}```
what is this thing
Any can help?
with ?
yo can someone explain to me this coding thing :