#off-topic-lounge-text
1 messages · Page 25 of 1
pets
thank you so much
sincerely
u saved some hours of my life. ill use these extra hours for the humanity
I also added __iter__ and __str__ for debugging
you can remove them if you dont need them
👍
please help me
I dont understand what you need
wait
def main():
y = input("\n hello welcome to smart boom: ")
x = "hello"
c = "help"
e = "open notepad"
g = "open cmd"
def hello():
if y == x:
input("\n hello to u ")
def helpp():
if y == c:
input("\n ((this is the list of comments)):\n hello \n open cmd \n open notepad \n ")
def openn():
if y == e:
input(os.system('notepad'))
def cmd():
if y == g:
input(os.system('cmd'))
cmd()
openn()
hello()
helpp()
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
os.system('cls' or 'clear')
main()
can you help me now?
def pascal_level(a_list):
print("this is into the function")
print(a_list, "this is a_list's starting value")
next_line= []
for i in range (len(a_list)):
print("works or not", "this is i", i)
if len(a_list)== 1:
print("a_list==1, executing second line")
next_line= a_list
next_line.append(1)
elif i < len(a_list)-1:
next_line.append(a_list[i]+a_list[i+1])
print(a_list, "re-checking a_list")
if len(a_list) > 1:
print(a_list, "this is a_list")
print("inserting the standard ones")
next_line.insert(0,1)
next_line.append(1)
print("this is the next_line")
print("this is the var next_line (still in function)")
print(next_line)
return next_line
"""
:param a_list: a list represents the previous level in the pascal's triangl\
\
e construction
:return: a new list with the previous elements summed
"""
pass
if __name__ == '__main__':
print("------------START---------------------")
next_line = [1]
print("moving into for loop")
for i in range(10):
print(next_line)
print("printed next line")
next_line = pascal_level(next_line)
print("updating")
print("out of the for loop now")
print(" ")
print(" ")
print("printing the other stuff near the end now")
print(pascal_level([1, 2, 3, 4, 5]))
print(pascal_level([1, 1, 2, 3, 5, 8]))
print(pascal_level([1, 1, 2, 3, 5, 8, 13, 1]))
print("---------------End----------------")
moving into for loop
[1]
printed next line
this is into the function
[1] this is a_list's starting value
works or not this is i 0
a_list==1, executing second line
[1, 1] re-checking a_list
[1, 1] this is a_list
inserting the standard ones
this is the next_line
this is the var next_line (still in function)
[1, 1, 1, 1]
updating
[1, 1, 1, 1]
printed next line
place = str(input("Някое място?: "))
print(f" Тук-{place} ще се видят нашите герой! ")
name =str(input("Име на вълшебен герой: "))
print(f" О, {name}. Това име е добро!Да продължаваме нататък")
name1 = str(input("Име на друг вълшебен герой: "))
print(f"О, {name1} и това име е добро! Да продължаваме към следващият въпрос")
relation = str(input("Какви били те (приятели или нещо друго):"))
print(f" Те били {relation}. Да отидем на следващият въпрос ")
activity = str(input("Какво обичали да правят:"))
print(f"Добре, те обичали да {activity}. Да продължаваме нататък!")
age = int(input("На колко години бил първият герой?: "))
print(f" Той бил на {age}, което е доста добре. Хопити попити към следващият въпрос ")
age2 =int(input("На колко години бил вторият герой?:"))
print(f" Once upon a time in {place}, there were {name} and {name1}. They were{relation}.
They love to do {activity}.
{name} was {age} years old and {name1} was {age 2} years old")
print(f" Тук-{place} ще се видят нашите герой! ")
name =str(input("Име на вълшебен герой: "))
print(f" О, {name}. Това име е добро!Да продължаваме нататък")
name1 = str(input("Име на друг вълшебен герой: "))
print(f"О, {name1} и това име е добро! Да продължаваме към следващият въпрос")
relation = str(input("Какви били те (приятели или нещо друго):"))
print(f" Те били {relation}. Да отидем на следващият въпрос ")
activity = str(input("Какво обичали да правят:"))
print(f"Добре, те обичали да {activity}. Да продължаваме нататък!")
age = int(input("На колко години бил първият герой?: "))
print(f" Той бил на {age}, което е доста добре. Хопити попити към следващият въпрос ")
age2 =int(input("На колко години бил вторият герой?:"))
print(f" Once upon a time in {place}, there were {name} and {name1}. They were{relation}.
They love to do {activity}.
{name} was {age} years old and {name1} was {age 2} years old") ```
@civic lantern it has error
@civic lantern it has error
@primal bison yeah. I was trying to see it in format
place = str(input("Някое място?: "))
print(f" Тук-{place} ще се видят нашите герой! ")
name =str(input("Име на вълшебен герой: "))
print(f" О, {name}. Това име е добро!Да продължаваме нататък")
name1 = str(input("Име на друг вълшебен герой: "))
print(f"О, {name1} и това име е добро! Да продължаваме към следващият въпрос")
relation = str(input("Какви били те (приятели или нещо друго):"))
print(f" Те били {relation}. Да отидем на следващият въпрос ")
activity = str(input("Какво обичали да правят:"))
print(f"Добре, те обичали да {activity}. Да продължаваме нататък!")
age = int(input("На колко години бил първият герой?: "))
print(f" Той бил на {age}, което е доста добре. Хопити попити към следващият въпрос ")
age2 =int(input("На колко години бил вторият герой?:"))
print(f" Once upon a time in {place}, there were {name} and {name1}. They were{relation}.They love to do {activity}.{name} was {age} years old and {name1} was {age2} years old")
@dusty sigil thank you very much bro
No problem
No problem
@dusty sigil just wondering, have u got any tips, i just started gcse in computer science
Bruh, what's GCSE?
Hey i want to print both in one one line can anyone help me?
print("inch: ") print(inch)
if anyone here knows some web scrapping please dm me
print(linked[2])
print(linked[2].get_string())
print(linked[2])
print(linked[2].get_string())
linked = LinkedList()
linked.add('forward', 1, 'a')
linked.add('forward', 2, 'b')
linked.add('forward', 3, 'c')
linked.add('backward', 1, 'g')
linked.add('backward', 2, 'f')
linked.add('backward', 3, 'e')
linked.add('backward', 4, '1')
print(linked)
Reminder that School Availabilities must be handed in by August 24th. If you do not hand one in your availability will be 3-11 Mon-Fri, and open-close on weekends.
The New Creamy Black Pepper Angus starts on Aug 28th, all staff must be aware of the new product build.
All Service staff, the new digital McCafe rewards program has started, please read the info posted in OurLounge
Here is your schedule for the week of 8/27/2018:
Monday, August 27, 2018 2:00 PM - 9:30 PM, GR
Tuesday, August 28, 2018 11:30 AM - 5:00 PM, GR
Wednesday, August 29, 2018 11:00 AM - 5:00 PM, GR
Thursday, August 30, 2018 11:00 AM - 5:00 PM, GR
Saturday, September 1, 2018 11:00 AM - 5:30 PM, GR
Sunday, September 2, 2018 8:00 AM - 2:00 PM, L/L
You have a total of 37.5 hours, 6 shifts and 0 closes.
If you have any questions about your schedule, please contact me, in person or by phone, as soon as possible.
Regards,
Your manager.
Note: This email account is used for information distribution only. No replies nor email should be sent directly to this account.
!e
print("How come we can use eval in coode help ??
You are not allowed to use that command here. Please use the #bot-commands channel instead.
Need help
Eval sound now be available in this channel!
@shut tree i was getting some help with my code to calculate my bi weekly pay based off my work schedule
!e yoink
@broken talon :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 'yoink' is not defined
bruh
!e
print("HELLO")
@pulsar lava :white_check_mark: Your eval job has completed with return code 0.
HELLO
@hardy egret check this
i saw that link doesnt work
Really?
big come up
python --version
20.2.4
pip install --upgrade pip
Hey @hardy egret!
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:
@primal bison do you need some help
@primal bison What's the issue?
for number in [1,2,3]:
print(number)```
def swap(the_list, i, j):
the_list[i],the_list[j] = the_list[j], the_list[i]
print("The list is now the following:")
print(the_list)
print(" ")
pass
def find_max_index_after(i, the_list):
j= 0
num_max=0
for i in range (len(the_list[i:])):
print("this is i", i)
print (the_list[i:])
for j in the_list[i:]:
print("this is j", j)
if j > num_max:
print("i=",i,"This is the max",max(the_list[i:len(the_list)]))
j=max(the_list[i:len(the_list)])
j=the_list.index(j)
swap(the_list, i, j)
pass
def reverse_selection_sort(the_list):
i=0
find_max_index_after(i,the_list)
return(the_list)
pass
why am I muted
a = 0
for number in [1,2,3]:
if number == 2:
a = number```
a = 0
b = -7
if a > b:
b = a```
alpha = [1,7,3]
for each in alpha:
print(each)```
[5,7,8][0] == 5
[5,7,8][1] == 7
[5,7,8][2] == 8
nums = [1,5,8]
_max = nums[0]
_min = nums[0]```
number = 5
if number > _max:
_max = number
if number < _min:
_min = number```
for number in [1,2,7]:
print(number)```
A sneaky way around the problem would have been sorted.
index 0 and index -1 of a list of numbers would get you the min and max.
hi guys
Hey @calm cypress!
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:
Hey @calm cypress!
It looks like you tried to attach file type(s) that we do not allow (.pptx). We currently allow the following file types: .3gp, .3g2, .avi, .bmp, .gif, .h264, .jpg, .jpeg, .mkv, .mov, .mp4, .mpeg, .mpg, .png, .tiff, .wmv, .svg, .psd, .ai, .aep, .xcf, .mp3, .wav, .ogg, .webm, .webp, .flac, .afdesign, .m4a, .csv.
Feel free to ask in #community-meta if you think this is a mistake.
start by splitting your file, where each line in the file becomes an element in a list @calm cypress
assign the data in your lines to their appropriate variables
hi
anyone offering help for a simple loop question?
can some one help me plz
its just a small favor
i dont have voice permission so I asked here
I do! @warm bone
It's a simple question. I can hear you.
I just can't talk.
Do you know anything about HTML and Javascript?
yeah
Haha, I can hear you.
Ok, so I have a form.
How do I access the variable in the form?
<label for="FirstNumber">First Number:</label><br>
<input type="text" id="FirstNumber" name="FirstNumber"><br><label for="SecondNumber">Second Number:</label><br> <input type="text" id="SecondNumber" name="SecondNumber"><br><input type="submit" value="Multiply!">
</form>```
That's the form. Probably not the cleanest.
Which is the variable so I can then write the function in Javascript?
So for example 'var x=3, var y=4 print(y*x)'
How do I find out which is X and Y in the form?
I'll BRB. Sorry. My dinner is burning.
ok
Ok, sorry.
bird, what's up
Hey Coby.
Do you know anything about HTML and Javascript?
My question is probably pretty easy.
yes actually, that's my main stack right now
Convenient!
very
So i'm just learning. I know a lot of Python, so I may use pythonic language, sorry about that.
that's fine
But in HTML, in a form, how do I get the variable from said form? So if you'll look above, you'll see some code.
And in that it basically takes two numbers, and the idea is to multiply them. Here's the javascript form I have after it.
function multiply() {
alert("You multiplied!")
}
</script>```
like, you're trying to get what the user inputs?
Obviously this doesn't multiply them, it just pops an alert.
But the idea is to then call the function to do just that.
And yes.
So whatever the first number is, then the second.
ok, so if you wanted to get the text from the text input with id of "FirstNumber", in javascript it would be document.getElementById("FirstNumber").value
Ok. So would I do something like var x = document.getElementById('FirstNumber').value ?
so in a function it would be something like
let x = document.getElementById("FirstNumber").value
yeah
let, var, whatever
Great. Then change the function to like...function multiply(x,y) { document.write('Result: '+x*y)?
I know in Python code you have to convert the answer to a string to concatenate it. Does JS have that?
Or is there a return function like in Python?
nope, js is dynamicly typed
Ok. Could you explain that to me?
wait, I may have read that wrong
oooh, nevermind
dynamically typed language like JS basically means that when you do console.log("number: " + 5) it auto turns the 5 into a string
Oh, nice. Very helpful.
also "console.log()" logs something to the console, if you didn't know
I wouldn't recommend ever using document.write() lol
Oh, haha.
Ok.
Fair enough.
So here's my code that I changed, but when I enter in the numbers, I just get 0 every time.
because writing text that way after the page is loaded just deletes everything
let x= document.getElementById('FirstNumber')
let y=document.getElementById('SecondNumber')
function multiply(x,y) {
alert("Your result is: "+x*y)
}
</script>
<form onsubmit="multiply(x,y)">
<label for="FirstNumber">First Number:</label><br>
<input type="text" id="FirstNumber" name="FirstNumber"><br><label for="SecondNumber">Second Number:</label><br> <input type="text" id="SecondNumber" name="SecondNumber"><br><input type="submit" value="Multiply!">
</form>```
When I put the script after the form, it returns 'Your result is: NaN'
do you know what NaN means?
'Not a Number'
oooh, I know what's wrong
so, there are a lot of things wrong with your code
but you're new so It's fine
I'm not surprised, haha. This is like...My first or second day digging into this.
I wish I could be voice verified already so I could not have to type it all
Same.
wanna join a dm vc?
hello everyone,
i am working on codeignitor4
but the "<?= $validation->listErrors() >"this function is not working in my code
and i am using it for show the simple error message in my login form
i also try "<? =$validation->showError() >" this function also but its also not working.
please help me
o
Need someone to review a few lines of code for a school project if anyone is able.
@cunning thistle maybe if you post the code
hi i want to know how to create a luncher in python
to lunch 2 scripts
r = requests.get(URL)
your_data = r.json()
print(your_data)
'name': 'ign'
'name': 'IGN', 'profileIconId': 3381, 'revisionDate': 1603150848000, 'summonerLevel': 35}
your_data['name']
myrandomdict = {"firstkey": "firstvalue", "secondkey": "secondvalue"}
to print the value corresponding to the key "firstkey"
print(myrandomdict["firstkey"])
which will return 'firstvalue'
myrandomdict = {"firstkey": {"test1": "value1", "test2": "value2"}, "secondkey": "secondvalue"}
print(myrandomdict["firstkey"["value1"]])
print(myrandomdict["firstkey"]["test1"])
with your fingers
hi
yo

@river parrot did you want help with something?
I do so im working with some hashtables and need help with some overriding of functions .
Hey @river parrot!
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:
def hashfunction(self, key, size):
""" insert commments (in your words) """
return key % size
def rehash(self, oldhash, size):
""" insert commments (in your words) """
return (oldhash + 1) % size
def get(self, key):
""" insert commments (in your words) """
startslot = self.hashfunction(key, len(self.slots))
data = None
stop = False
found = False
position = startslot
while self.slots[position] != None and not found and not stop:
if self.slots[position] == key:
found = True
data = self.data[position]
else:
position = self.rehash(position, len(self.slots))
if position == startslot:
stop = True
return data
def __getitem__(self, key):
""" insert commments (in your words) """
return self.get(key)
def __setitem__(self, key, data):
""" insert commments (in your words) """
self.put(key, data)
def __len__(self,list):
res = list(filter(None,TestHashTable))
use '`' 3 times then write python '''python then shift enter to go the next line, and end it with '''
print("hello world")
def hashfunction(self, key, size):
""" insert commments (in your words) """
return key % size
def rehash(self, oldhash, size):
""" insert commments (in your words) """
return (oldhash + 1) % size
def get(self, key):
""" insert commments (in your words) """
startslot = self.hashfunction(key, len(self.slots))
data = None
stop = False
found = False
position = startslot
while self.slots[position] != None and not found and not stop:
if self.slots[position] == key:
found = True
data = self.data[position]
else:
position = self.rehash(position, len(self.slots))
if position == startslot:
stop = True
return data
def getitem(self, key):
""" insert commments (in your words) """
return self.get(key)
def setitem(self, key, data):
""" insert commments (in your words) """
self.put(key, data)
def len(self,list):
res = list(filter(None,TestHashTable))
oh okay I see what you mean!
so the last function I want it to return the number of items stored in the hash table
I wanted to filter out the None variables so it could just count the rest of the variables
yes its a function inside a function
the class is there I just didn't paste it because at first it didn't let me paste over 200 characters.
right, so whats your question
@river parrot not sure what function you want to override
I need to override the function to work with HashTable in a specific way - Using def len will override the Python len() function.
right so what behaviour are you looking for?
return a, b
return a, b
result_a, result_b = function_2(1, 2)
tuple_of_numbers = (1, 2, 3, 4)
tuple()
@rotund zephyr
def second_function():
print('yey2') # this will be executed when you call this function
return None
print('yey3') # this will not be executed, since `return` caused the function to exit
def first_function():
print('yey1') # this will be executed when you call this function
second_function() # this calls the function, which you've assigned before
print('yey4') # this also will be executed since there is no `return` within THIS function
!e
def second_function():
print('yey2') # this will be executed when you call this function
return None
print('yey3') # this will not be executed, since `return` caused the function to exit
def first_function():
print('yey1') # this will be executed when you call this function
second_function() # this calls the function, which you've assigned before
print('yey4') # this also will be executed since there is no `return` within THIS function
first_function()
@remote raft :white_check_mark: Your eval job has completed with return code 0.
001 | yey1
002 | yey2
003 | yey4
So, as you can see, the third "yey" is missing, while "yey4" is still there
flat_charge = 20.00
if weight <= 2:
return weight * 1.50 + flat_charge
elif weight > 2 or weight == 6:
return weight * 3.00 + flat_charge
else:
weight > 6 or weight == 10
return weight * 4 + flat_charge
print(ground_shipping (7))```
It's only printing the second function why doesn't it print the third?
!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!*
NaMeme
nah meme
H
Hi
what is python
google it
ds
hi
!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.
seconds = input('Give a number. > ')
while seconds.isnumeric() is False:
# print ("Please enter how long you would like to play the game")
# else:
seconds = input('Give a number. > ')
timer = int(seconds)
NameError: name 'seconds' is not defined
while seconds.isnumeric() is False:
# print ("Please enter how long you would like to play the game")
# else:
seconds = input('Give a number. > ')
timer = int(seconds)
seconds =5
5.isnumeric()
Nope.
dir(int)
help(int)
dir(4)
dir(str)
dir('')
bye guys need to go for english exams 😅
ValueError: invalid literal for int() with base 10: 'hi'
seconds = "hello"
while seconds.isnumeric() is False:
seconds = input('Give a number. > ')
timer = int(seconds)
@primal bison see the voice-verification channel
!voiceverify
@primal bison Ye just look at my DP u'll learn how 
Can any1 explain y i get this error in Django Form validation
Traceback (most recent call last):
...
ValidationError: ['This field is required.']
@molten herald
https://docs.djangoproject.com/en/3.1/ref/exceptions/
Ye got it thanks for the help
your welcome :)
my voice has been seliencyed
@sand pelican Look into the #voice-verification channel. That should tell you what you need to know
is anyone there? can someone help me with some codes?
def hi_lo_game(high):
"""
-------------------------------------------------------
Plays a random higher-lower guessing game.
Use: count = hi_lo_game(high)
-------------------------------------------------------
Parameters:
high - maximum random value (int > 1)
Returns:
count - the number of guesses the user made (int)
-------------------------------------------------------
"""
guess = int(input("Guess: "))
num = randint(1,high)
count = 0
while num != guess:
count += 1
if guess > num:
print("Too high, try again")
guess = int(input("Guess: "))
else:
print("Too low, try again")
guess = int(input("Guess: "))
print("Congratulations - Good Guess!!!")
return count
print(hi_lo_game(50))
"""
-------------------------------------------------------
Asks a user to enter a series of positive numbers, then calculates
and returns the minimum, maximum, total, and average of those numbers.
Stop processing values when the user enters a negative number.
The first number entered must be positive.
Use: minimum, maximum, total, average = positive_statistics()
-------------------------------------------------------
Returns:
minimum - smallest of the entered values (float)
maximum - largest of the entered values (float)
total - total of the entered values (float)
average - average of the entered values (float)
------------------------------------------------------
"""
gys
I built a state monitor using Python + Flask! Github:https://github.com/yoobool/flask-state . Should i can get some improvement suggestions from anyone? Thanks~
I started with java but didn't like it, so went it python, and now I am learning java again to get into minecraft modding
X = 1
Y = 1
print ('{:>4}' .format(''), end= '')
for X in range(1, 11):
print('{:>4}'.format(X), end='`)
print()
for X in range(1,11):
print('{: >4}'.format(X), end
while Y <= 10:
print('{:>4}'.format(X * Y), end= '`)
Y+=1
print()
Y=1```
Help please
i made up alarm code
python scrapy xpaht Not work for me
https://prnt.sc/veb11l
This is the page source and following are my xpaths.
- response.xpath("//div[@id='divBannerCont']") - success get
- response.xpath("//div[@id='divBannerCont']//input[@type='submit']") - Not get.
Please let me fix that if you can help me.
Thanks.
@outer grail Heya. Do you require assistance?
Is my headphone broken or noone speaking
Nobody was speaking.
Mm. It looks like you only have three messages.
hi guys i am stuck with my assignment is there some who can help me ?
is a ISBN check that i need to make in python i am have 80% fof 100% complete
import sys
ISBN = input('Enter a ISBN: ')
isbn = {'0','1','2','3','4','5','6','7','8','9','10','X'}
def controlNumberCheck():
list1 = []
# this for loop slice every number from the string and multiples it and then adds it
for i in range(0,9):
a = ISBN[i]
list1.append(a)
multiply_list = [10,9,8,7,6,5,4,3,2]
controlNumber = 0
for c in range(0,9):
multiply = int(multiply_list[c]) * int(list1[c])
controlNumber = int(controlNumber) + int(multiply)
#print("controlnumber: "+ str(controlNumber))
return int(controlNumber)
#checkDigit
def checkDigitF():
tempDigit = 0
tempDigit = int(controlNumberCheck()) % 11
checkDigit = 11 - tempDigit
#print("CheckDigit: " + str(checkDigit))
return int(checkDigit)
#Test: (control number + check digit) / 11
def Test():
test = (controlNumberCheck() + checkDigitF()) / 11
#test2 = controlNumberCheck() + checkDigitF()
#print("test2:" + str(test2))
#print("Test: " + str(test))
return int(test)
controlNumberCheck()
if not isbn.issuperset(ISBN) or len(ISBN) > 11 or len(ISBN) < 10:
print('INPUT ERROR')
sys.exit()
else:
print('Go On !')
print()
#1853753904
!e
a = [1, 2]
b = [2, 4]
print(c=a*b)
@sinful onyx :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 3, in <module>
003 | TypeError: can't multiply sequence by non-int of type 'list'
Hey @bleak trellis!
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:
!code-blocks
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.
print('Hello world!')
sudo apt-get install python3.8
print("hasmokar na bel chukar")
@visual stirrup wtf are you
@buoyant kestrel yo man
i wanna make an anti spam bot but i cant
@hallow jasper how to get mod
!mod
Contacting the moderation team via ModMail
@subtle palm is a bot that will relay your messages to our moderation team, so that you can start a conversation with the moderation team. Your messages will be relayed to the entire moderator team, who will be able to respond to you via the bot.
It supports attachments, codeblocks, and reactions. As communication happens over direct messages, the conversation will stay between you and the mod team.
To use it, simply send a direct message to the bot.
Should there be an urgent and immediate need for a moderator or admin to look at a channel, feel free to ping the <@&267629731250176001> or <@&267628507062992896> role instead.
@primal bison I'm not sure precisely what you mean by "wtf are you"
@visual stirrup Idk i just wanted you to know me
okay.
#voice-verification ?
I may not talk much.
and also remembering you're doing something which I have not had a lot of experience with. That is, dual booting within one drive and also working with windows 10.
Typing.
Not seven.
Because I don't want to disturb the other people in my house.
Do you need to switch the usb mode to something else before you enable usb tethering?
For example, on mine, it can't be on just charge, it has to be on something like usb storage or the fake cd drive thing.
@torn halo ^ ?
Give it a go.
Do you get a popdown when you're plugged in to usb?
Saying "Hey, I'm usb connected"
Where you tap on it to change the mode
Maybe look in the settings
Okay.
I can.
Investigate how to change the usb mode.
This is seperate from tethering.
There may be a PTP mode and a USB storage mode in the mix.
and also a charge only mode
You may be set to be on charge only mode
Being on something like PTP or USB storage mode may allow you to activate the tethering setting
@primal bison Did you need any help, or are you just checking things out? 🙂
Just checking things out in voice chat for now since I don't have enough exp or whatever to talk lol, but I did post a question in #help-chestnut
I...see.
I'm honestly not quite certain where to start with that, I'm afraid. Hopefully there'll be someone who comes along who does. 😅
hi
Hello i have a problem i'm making a battleship game for my school project and im using tkinter we are at a pretty advanced stage but we have a problem, we use random generation for the ships and sometime the ships are overlapping each others does anyone have a solution ? here is the code
Hey @timber kayak!
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:
ok i can't post the code its in french anyway no one would understand the var
@halcyon coyote
psl
can you help me
,
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.
how ok
Hey @timber kayak!
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:
Hey guy's how can i make the "40" an integer bc everytime i do:
int(40)
It doesn't work.
Here is my code:
class Robot:
def introduce_self(self):
print("My name is: " + self.name)
print("My color is: " + self.color)
print("I weigh: " + self.weight + " " + "killograms")
r1 = Robot()
r1.name = "Tom"
r1.color = "blue"
r1.weight = "40"
r1.introduce_self()
inside the function
@mild steppe
Just use
print(f"I weigh: {self.weigth} killograms")
with f strings everything inside of {} gets converted to a string
do str(self.weight)
from pathlib import Path
json_file = Path("data.txt")
if not json_file.exists():
with open("data.txt", "w") as file:
file.write("[]")
async def _add(ctx, arg):
if ctx.channel.id == int(config.get("bot","channelID")):
json_file = Path("data.txt")
if not json_file.exists():
with open("data.txt", "w") as file:
file.write("[]")
with open("data.txt", "r+") as file:
waitlist = {
"username": arg,
"time":int(time.time())
}
json.dump(waitlist, file)
#Sends a confirmation message in the discord channel
await ctx.send(f"> Player **{arg}** has been added to the waitinglist")
else:
await ctx.send("This bot is not allowed to be used in this channel!")
async def _add(ctx, arg):
if ctx.channel.id == int(config.get("bot","channelID")):
json_file = Path("data.txt")
if not json_file.exists():
with open("data.txt", "w") as file:
file.write("[]")
with open("data.txt", "r") as file:
waitlist = {
"username": arg,
"time":int(time.time())
}
with open("data.txt", "w") as file:
json.dump(waitlist, file)
#Sends a confirmation message in the discord channel
await ctx.send(f"> Player **{arg}** has been added to the waitinglist")
else:
await ctx.send("This bot is not allowed to be used in this channel!")
waitlist.update({
with open("data.txt", "r") as file:
json_loaded = json.load(file)
json_loaded.append({"username": arg, "time":int(time.time())})
{'username': 'testttwo', 'time': 1605110201}
Nah
Buddy of mine gifted me some
But I normally wouldn't buy it
Don't really use the other gifs from other servers
ah
And we get a lot of perks for the server anyway because we're partnered
you can have animated pfp's
Yeah but eh
lol
But then I wouldn't have me looking smug (which is the only face I have, apparently)
Thanks @rancid pumice
And i have an other question if anyone wanna answer that:
name = float(input("What is you're name?: "))
ValueError: could not convert string to float: 'Rayan'
Why no
...?
Ah lol i tought float was letters but anyways thanks @merry meadow
No worries! Everybody starts somewhere
indeed!
yee python is from my country!!!
lol
does python still have a dutch owner?
and yes netherlands
but is he dutch?
cool!
hmm
what's the best way to study a module?
i can't really find help on the ui module in the application pythonista 3 on ios devices
yeah but it like doesn't show me the tab function
yeahhh
repel what?
lol
Repl.it is a simple yet powerful online IDE, Editor, Compiler, Interpreter, and REPL. Code, compile, run, and host in 50+ programming languages: Clojure, Haskell, Kotlin, QBasic, Forth, LOLCODE, BrainF, Emoticon, Bloop, Unlambda, JavaScript, CoffeeScript, Scheme, APL, Lua, Pyt...
hmmmm
woah
sick
thank you!
is it free?
:o
wth
how do people
make that much stuff
and they make it free...
ah
but still
lol
hmm
cool
my school should use this
to learn us program
ehm
hemlock
what is some experience?
is that like knowing if statements
and while loops?
@rancid pumice what you making now?
say again pls
@rancid pumice could you say it again please?
ah hes gone
with open("data.txt","r") as file:
newlist = [d for d in file if d["username"] != arg]
with open("data.txt","w") as file:
print(newfile, file=file)
Should that be newlist?
still gives the error but yes ty for noticing the type error
TypeError: string indices must be integers
Is d a string?
yes
Erm, so d is a line of the file. So it's a string and you can't index it with a string.
What does the file look like?
[{"username": "testing", "time": 1605120807}, {"username": "testing2", "time": 1605120810}]
Sure 😄
{}
This a json file?
Hmm, could you use the json library?
yep
One sec while I check the docs...
Right 😄
with open('data.txt', 'r') as file:
data = json.read(file)
new_data = [
d
for d in data
if d['username'] != ...
]
with open('data.txt', 'w') as file:
json.dump(new_data, file)
The ... is because I wasn't sure what you wanted there.
arg
Oh yes 😄
I'm even looking right at the documentation...

Nice 👍
Great stuff
No problem
new_data = [d for d in data if d['username'] != arg]
So, you have a list of dictionaries.
for d in data just iterates through this list.
d is assigned to each dictionary in the list.
It's a variable name.
This code is equivalent to the following:
['username'] for ['username']
new_data = []
for d in data:
if d['username'] != arg:
new_data.append(d)
d = ['username']
Erm, d would be something like {"username": "testing", "time": 1605120807}
A dictionary.
Then you access the username by doing d['username']
Which will be 'testing'
Alright 😄
Making sure...
Yep
It's definitely worthwhile reading the official python tutorial.
It's not bad.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
?
Oh yeah, it's overwhelming to get so many suggestions.
I would stick to just the tutorial.
The official tutorial.
Nope, no affiliation 😄
Although, Guido does know about us 😄
Yeah, stick to one resource...
if you get stuck
find a video on youtube, or post a question here.
It's kind-of a slog, but it's well worth going through most of the tutorial.
StackOverflow is... yeah
Not bad for professional programmers.
But very discouraging for beginners.
Oh yeah, I've been through that 😄
Yeah, Hemlock's alright
Btw, it's better if you think of StackOverflow as being like a Wikipedia for code.
Then it doesn't feel so personal
When your question gets closed
I had one closed within 20 seconds of posting it 
I spent like 20 mins writing it as well 😄
It's a "lemoji"
Erm, I'm kind-of new here
But one of the owners of the server is called lemon
Yep
So we have a load of lemon-themed emojis

Love that one 😄

Erm, I do have a mic. But I have a thing about talking on mic.
Idk, I need to get over it 😄
Yep.
28
Thanks
Ohh, ok
Hemlock's the same age I think as me.
Yep, I'm going to get back to the help channels...
See ya!
wow
wow
haha
hah- nah im not doing that not bored enough
I though that she is talking to herself then I read its vc chat
Haha
*himself
Someone thought I was a gal like 20 sec ago too LXNN
idk can't judge gender with names
read #help-cupcake
I was also thinking same
Someone thought I was a gal like 20 sec ago too LXNN
@sudden gull
LMAO
Haha
really is your hair too long
ouch
or it isn't you in that pfp
haha
goodnight 😂
gn
I take no responsibility!
Hahah
hi, can I get some help with my code? I'm not able to get exactly the output that the problem is looking for
how can I adjust my code so that the output doesnt add a bunch of zeros after the decimal point
@zenith hazel Depending on what your program is doing, you may find one or more of the following to be of use. str.rstrip, int, round, float.
@zenith hazel another possible solution could be variableName = "%.2f" % outputVariable
where the %.xf is however many spaces you want to round it to
heyy i am getting this error when i am trying to read through a csv file
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 33-34: truncated \uXXXX escape
i have tried all the possbile solns given on stackoverflow but it still doesn't work
can someone help me with this!!?
Hi!
I am new to Github, I uploaded a repository from Pycharm to Git and now I want to remove the connection
Does anyone know how to do that?
@soft compass, there's not active connection to GitHub, if you want to unlink your project with your remote repository you can remove the remote [1] or just remove the entire .git folder. Have in mind that removing the .git folder is dangerous if you don't want to lose your local repository history
[1] https://git-scm.com/docs/git-remote#Documentation/git-remote.txt-emremoveem
Which one do you recommend?
Can you do it manually from pycharm or do you have to use the command prompt?
depends on your needs. If you want to remove the remote reference to GitHub but keep the local history. Just remove the remote. If you want to remove the the remote reference to GitHub and remove the local history, remove the .git folder. You might do any of both using PyCharm
If I remove the local history will the files with code in pycharm still be intact?
yes
no
Where do you find the git folder?
it should be in your project root
Do you know where you find it on pycharm?
The f5 thing?
def check_input():
while True:
try_again = input("Do you want to try to enter a number again? ").lower()
if try_again not in ("y", "yes", "yeah", "n", "nope", "no"):
print("Please input: y, yes, or yeah to try again.")
print("Please input: n, no, or nope to exit.")
continue
else:
# this will make try_again True if it starts with y, otherwise False
try_again = try_again.startswith("y")
return try_again
if try_again:
continue
else:
print("See ya later.")
if not try_again:
print("See ya later.")
Traceback (most recent call last):
File "C:\Users\gabri\PycharmProjects\Turtle things\Shapes.py", line 60, in <module>
start()
File "C:\Users\gabri\PycharmProjects\Turtle things\Shapes.py", line 56, in start
main(number_of_sides)
File "C:\Users\gabri\PycharmProjects\Turtle things\Shapes.py", line 25, in main
distance = int(length)
UnboundLocalError: local variable 'length' referenced before assignment
Hey, so i watched a few youtube tutorials about classes and objects in python and i do not understand why there is a return True under this return False:
def add_student(self, student):
if len(self.students) < self.max_students:
self.students.append(student)
return True
return False
while True:
side_length = input("How long are your sides? ")
try:
length = int(side_length)
break
except ValueError:
print("I'm sorry, that is not a valid input for length of sides. Please use an integer.")
@tender tangle Are u here to show of that code or are u asking help?
I'm not asking for any help
I'm helping twiitchkicks
Why do you ask?
do not use the first method
it is ugly
:3
Hey guys!
I am new to python and i just learned "OOP".
But now i want to learn how i can visualize stuff to make stuff more beatifull because i want to make a card game or something.
Does anyone knows a good tutorial or something or just the keyword i need to search to fi
Hey guys!
Can someone please help me because i do not understand this error.
File "C:/Users/rayan/PycharmProjects/pythonProject2/Rly quick.py", line 11
t1 + t2 + t3 = gg
^
SyntaxError: cannot assign to operator
Here is my script:
class Rayan:
def __init__(self, dw):
self.dw = dw
def getdw(self):
t1 = 50
t2 = 90
t3 = 70
def __add__(self, t1, t2, t3):
t1 + t2 + t3 = gg
def divide(self, other):
return gg / 3
chris also look "e-commerce db-design" or "e-commerce db-structure" up
there are some simple db diagrams on the internet for free
I've used django forms when creating the items
Ahhh I see
Yeah I never actually considered it that way!
Ok, that's great
thanks very much for your help!
@mild steppe it seems like some of your definitions don't do anything, do they need to return something? Also, I think the error is that it wants gg = t1 + t2 + t3, but it doesn't seem like you are specifying them in a way that they are going to be updated correctly.
@mild steppe try:
gg = t1 + t2 + t3
Oke thanks guys
Hey @thick walrus!
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:
anybody want to vc with me to help start of k means clustering? im a complete noob at it
its just to get me started with my dataset because i have no idea what columns to use for clustering
@stark nacelle did you look at using panda's ewp function? Source: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.ewm.html
can someone help me
Guys I need help I want to install py audio but i have a eror
Pls help me
hello at all
how can i use the output of the df linux command in python to make insert to a sql database?
[21:03]
anyone an idea?
[21:04]
df -Ph /dev/sda1 | grep -Po '\d+(?=%)'
this outputs me in linux the percent of the used storage
[21:05]
but how can i get the only the gb size in Numbers as an output ?
I can't talk in the channel yet
So now I have to wait
I guess
@sharp marlin U is Uniform
@sharp marlin H it Hotel
letters = {
"A": "Alfa",
"B": "Bravo",
"C": "Charlie",
"D": "Delta",
"E": "Echo",
"F": "Foxtrot",
"G": "Golf",
"H": "Hotel",
"I": "India",
"J": "Juliett",
"K": "Kilo",
"L": "Lima",
"M": "Mike",
"N": "November",
"O": "Oscar",
"P": "Papa",
"Q": "Quebec",
"R": "Romeo",
"S": "Sierra",
"T": "Tango",
"U": "Uniform",
"V": "Victor",
"W": "Whiskey",
"X": "X-ray",
"Y": "Yankee",
"Z": "Zulu",
" ": " ",
}
input_str = input("Type the sentence you wish to convert:\n")
input_list = list(input_str)
output_list = []
for i in input_list:
try:
output_list.append(letters[i.upper()])
except KeyError:
output_list.append(i)
output_str = " ".join(output_list)
print(output_str)
Damn you actually said my name right
That's surprising
Because peopel fuck my name up all the time
You were bollocking them earlier
Nah Peewee
Dude
FUCK Node and Python
he says in a Python server
@formal cipher https://radioaficion.com/news/hf-transceiver-diy/
He bought it second hand
My GPU costs more then 175 euros
Later @sharp marlin
He sounds like he's 10
15!?
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\batuh\AppData\Local\Temp\pip-install-kkml3_6s\pyaudio\setup.py'"'"'; file='"'"'C:\Users\batuh\AppData\Local\Temp\pip-install-kkml3_6s\pyaudio\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\batuh\AppData\Local\Temp\pip-record-p1wrhfgt\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\batuh\AppData\Roaming\Python\Python39\Include\pyaudio
pyaudio
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: setuptools in c:\program files\python39\lib\site-packages (49.2.1)
python -m pip install wheel
"error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/"
How did the installation of the MS C++ 14 library go?
pip install pyaudio
pip install pyaudio
Defaulting to user installation because normal site-packages is not writeable
Collecting pyaudio
Using cached PyAudio-0.2.11.tar.gz (37 kB)
Building wheels for collected packages: pyaudio
Building wheel for pyaudio (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\program files\python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\batuh\AppData\Local\Temp\pip-install-gcj6jrm4\pyaudio\setup.py'"'"'; file='"'"'C:\Users\batuh\AppData\Local\Temp\pip-install-gcj6jrm4\pyaudio\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 'C:\Users\batuh\AppData\Local\Temp\pip-wheel-rrpcnlh8'
cwd: C:\Users\batuh\AppData\Local\Temp\pip-install-gcj6jrm4\pyaudio\
Complete output (9 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
copying src\pyaudio.py -> build\lib.win-amd64-3.9
running build_ext
building '_portaudio' extension
What is in that directory?
Any log files?
No.
I didn't hear you because
Because I don't know what you need to do.
uhh
@tight scaffold Türk telekom mu kulanıyorsun ?
kablonet
Might we focus, please? 🙂
By the way, thank you so much for putting up with me
Thanks for everything opal
@lucid trench
hey
I'm here
What is in the folder?
I have 1000 ms
C:\Users\batuh\AppData\Local\Temp\pip-install-gcj6jrm4\pyaudio\
python -m pip check pyaudio
No broken requirements found
Hello, who knows about eel? Need help with this library for python.
@tight scaffold What is your IDE?
@tight scaffold what language do u speak?
eng
@tight scaffold What is your mother tongue?
tony türkçe desene
türkçe
tony türkçe desene
@lucid trench sen türkçe ne kadar biliyorsun
hayır ben denilenleri anlıyorum ama internetim kötü olduğu için iyi bir şekilde iletişim kuramıyorum
Maybe look at the dependencies for pyaudio on its official page. Look at the section for Windows, specifically.
See if it is listing anything that you don't have.
Perhaps look at the instructions for a Windows installation of pyaudio.
@tight scaffold söyle anlat onlara sesin kötü oldugunu
I have 1000 ms
#Translator
@client.command(aliases=['tr'])
async def translate(ctx, lang_trans, *args):
lang_trans = lang_trans.lower()
if lang_trans not in googletrans.LANGUAGES and lang_trans not in googletrans.LANGCODES:
raise commands.BadArgument("Invalid language to translate text to")
text = ' '.join(args)
translator = googletrans.Translator()
text_translated = translator.translate(text, dest=lang_trans).text
await ctx.send(text_translated)
import googletrans
from googletrans import Translator
@night lily
replika
Kaggle is the world’s largest data science community with powerful tools and resources to help you achieve your data science goals.
Learning Python should be fun and easy. We provide an interactive Python textbook that helps you learn to program in Python right in your browser.
Python Programming tutorials from beginner to advanced on a massive variety of topics. All video and text tutorials are free.
https://www.sololearn.com/
@lucid trench i have used it. Its pretty good for every one who is into programming .
just a min i'll speak in a min
With lifelike movement and trademark voice, the Butter Robot will deliver hours of fun - all while its complex 'emotion engine' creates unique interactions
@keen lily The bot should have DM'd you what criteria you're missing
Hey guys! How do i make a function that starts with 5 but everytime i want to it does -1 and the number is updated and printed at all times?
from datetime import datetime
def not_during_the_night(func):
def wrapper():
if 7 <= datetime.now().hour < 22:
func()
else:
pass # Hush, the neighbors are asleep
return wrapper
def say_whee():
print("Whee!")
say_whee = not_during_the_night(say_whee)
from datetime import datetime
def not_during_the_night(func):
def wrapper():
if 7 <= datetime.now().hour < 22:
func()
else:
pass # Hush, the neighbors are asleep
return wrapper
@not_during_the_night
def say_whee():
print("Whee!")
Erdős Pál
Erdős Pál
Erdős Lajos
k
@broken talon
what do you think?
read the instructions
it wants to print the number of digits in the parameter num
print the number of digits
yea sooo then
would it be D?
because it can't equal 0
or wait the number of digits can't be less than 0
it has to be 1 or greater
@broken talon
so you think the answer is D?
num is the number you want to count the digits of, count is the amount of digits
no
and count is when num finished increasing?
no
Oh man 😅
count is increased once for each iteration of the while loop
it would
what would num be then?
it's the number right?
that you want to count the digits of
ohhhh
you saw it changes
in the function
🧠💡
just going to paste it again so I don;t have to scroll up
so it's dividing by 10
@broken talon
yep
sure
Hi Lazy Dev, what up
I'm refactoring some stuff into different design patterns for a data collator
what type of projects do you typically work on
not being able to turn mic on in the voice chat is rather hindering
hey guys
sup
what you working on ROley
hey man lol On
what you code jammin on Roley?
I'm gettin drunk and working on package collators for databases
parsers - whatever you may like to call them
not being able to speak with voice is rather annoying
I think I have actually helped around 10 people solve problems within this discord, but apparently haven't typed enough, so here it is
sup
Th3Grizly
@zinc parcel Check out the #❓|how-to-get-help help channel. That'll tell you what you need to know to use our help system.
from pathlib import Path
horse_path = Path(r".\horse\super\mah_horse.jpg")
from pathlib import Path
horse_path = Path(r"./horse/")
horse_dict = {}
horse_folders = []
for x in horse_path.iterdir():
if x.is_dir():
horse_folders.append(x)
for folder in horse_folders:
horse_type = folder.parts[-1]
horse_dict[horse_type] = sorted(image for image in folder.iterdir())
horse_path = Path("folder1", "folder2", "file")```
from pathlib import Path
horse_path = Path("./horse/")
horse_folders = [x for x in horse_path.iterdir() if x.is_dir()]
horse_dict = {folder.parts[-1]: image for folder in horse_folders for image in folder.iterdir()}
I think you can skip the dot
actully, depends on the working dir set if you are running the program as a module
did you mean
horse_dict = {folder.parts[-1]: sorted(image for image in folder.iterdir()) for folder in horse_folders}```
from your first snippet
are you able to hear my pc fans?
not really.
alright, I was a lil worried about that
WHERE kind = arabic-black
@edgy mesa
@warm hedge that's no longer the case now
JavaScript is everywhere now
You can make backed apps using nodejs
You can develop cross platform moble apps using react-native
You can build cross platform desktop apps using electron.js
You can do machine learning (tensor flow is now available for JS)
message_input3 = pyautogui.prompt (text =" insert the delay between each sentence( in seconds ")
if message_input3 = True:
continue
else :
break
Different channel 😄
Erm, I've not got any experience with pyautogui sorry
Right, so what output were you expecting?
Does anyone know why isn't this thing working?
lower = np.array([hue_min, s_min, v_min])
upper = np.array([hue_max, s_max, v_max])
mask = cv2.inRange(hsv_img, lower, upper)
masked = cv2.bitwise_and(image, image, mask=mask)
in mask, I just see pure black output, even having lower = upper, it is still showing black
any idea why is it happening?
btw it is opencv
ping me if ya answer
nvm, figured it out
c.execute('INSERT INTO transactions VALUES (:Customer_Numb, Customer_N, Invoice_Numb, Invoice_D,Invoice_Am)',
{
'Customer_Numb': Customer_Numb.get(),
'Customer_N': Customer_N.get(),
'Invoice_Numb': Invoice_Numb.get(),
'Invoice_D': Invoice_D.get(),
'Invoice_Am': Invoice_Am.get()
}
#commit changes
base.commit()
why is there a syntax error on base.commit()?4
what is not working, again?
@light jungle
C:\WINDOWS\system32>pip install pyinstaller
'pip' is not recognized as an internal or external command,
operable program or batch file.
py -m pip install pyinstaller
Have you tried py -m pip
I just learnt about the py thing, super useful now
py -3.8
I think they added it specifically because of people asking for help all the time.
py -0
Erm, check the link I posted earlier for more info.
Do you need a windows license to install it in virtualbox, by the way?
It would help me to help out if I could launch windows.
Ah right.
Oh 😄
Alright, going back to the other channel...
?
typr here
hello
Hey, does someone here need help? @lean abyss @ivory kernel @graceful elk
im helping
not me
XD
i just came to listen
name = input("Enter the name of the customer you want to delete: ")
customer = [item for item in registers if item["clientName"] == name]
if len(customer) > 0:
else:
print("Failed on locate customer name" + nome)
start()
nomeCliente = input("Digite o nome do cliente: ")
cliente = [item for item in registros if item["nomeCliente"] == nomeCliente]
if len(cliente) > 0:
print("Já existe um cliente cadastrado com nome " + cliente["nomeCliente"])
criarRegistro()
cidadeCliente = input("Digite a cidade do cliente: ")
estadoCliente = input("Digite o estado do cliente: ")
telefoneCliente = input("Telefone do cliente: ")
if len(nomeCliente) > 0 and len(cidadeCliente) > 0 and len(estadoCliente) > 0 and len(telefoneCliente) > 0:
print("Nome Cliente: " + nomeCliente)
print("Cidade Cliente: " + cidadeCliente)
print("Estado Cliente: " + estadoCliente)
print("Telefone Cliente: " + telefoneCliente)
registro = {
"nomeCliente": nomeCliente,
"cidadeCliente": cidadeCliente,
"estadoCliente": estadoCliente,
"telefoneCliente": telefoneCliente,
}
registros.append(registro)
print("Cliente cadastrado com sucesso!")
print("------------------------------")
inicio()
If you know the index of the item you'd like to delete, you can do:
del myarray[index]
Be warned, you shouldn't do this multiple times in a loop, as deleting an item will change the indices of the following items.
Can you copy and paste the registros array here?
So I can show you an example.
pop()
Also, what should happen if there are multiple items with the same client name?
a_list = ["a", "b", "c"]
a_list.pop(1)
[{'nomeCliente': 'Álvaro', 'cidadeCliente': 'Belo Horizonte', 'estadoCliente': 'Minas Gerais', 'telefoneCliente': '98989898'}, {'nomeCliente': 'Álvaro Pereira', 'cidadeCliente': 'São Paulo', 'estadoCliente': 'São Paulo', 'telefoneCliente': '87878787'}]
Alright
!eval ```python
data = [
{'nomeCliente': 'Álvaro', 'cidadeCliente': 'Belo Horizonte', 'estadoCliente': 'Minas Gerais', 'telefoneCliente': '98989898'},
{'nomeCliente': 'Álvaro Pereira', 'cidadeCliente': 'São Paulo', 'estadoCliente': 'São Paulo', 'telefoneCliente': '87878787'},
]
data = [
record
for record in data
if record['nomeCliente'] != 'Álvaro'
]
print(data)
@cold lintel :white_check_mark: Your eval job has completed with return code 0.
[{'nomeCliente': 'Álvaro Pereira', 'cidadeCliente': 'São Paulo', 'estadoCliente': 'São Paulo', 'telefoneCliente': '87878787'}]
@cold lintel thats pretty fast
Do you need to modify the original array, or is it ok to create a new array with some records removed?
Yep.
You could find the index like this:
index = next(
i
for i, record in enumerate(data)
if record['nomeCliente'] != 'Álvaro'
)
Then do:
del data[index]
@cold lintel Yepp thats it
Although, it's slightly uncertain what will happen if there are multiple records with the same name.
Yep, data is registros
Sorry for changing the name 😄
If that caused confusion.
Sorry, there's a mistake in my code...
It should have been:
index = next(
i
for i, record in enumerate(data)
if record['nomeCliente'] == 'Álvaro'
)
You should only delete one record at a time this way.
index = next(
i
for i, record in enumerate(data)
if record['nomeCliente'] == 'Álvaro'
del [1]
)
Erm, I don't think del is valid syntax there.
nome = input("Digite o nome do cliente no qual você deseja excluir: ")
cliente = [item for item in registros if item["nomeCliente"] == nome]
if len(cliente) > 0:
index = next(i
for i, registro in enumerate(registros)
if registro['nomeCliente'] != nome
)
del registros[index]
else:
print("Não foi possível encontrar nenhum cliente com nome de " + nome)
nome = input("Digite o nome do cliente no qual você deseja excluir: ")
cliente = [item for item in registros if item["nomeCliente"] == nome]
if len(cliente) > 0:
index = next(i
for i, registro in enumerate(registros)
if registro['nomeCliente'] != nome
):
del registros[index]
else:
print("Não foi possível encontrar nenhum cliente com nome de " + nome)
name = input(...)
index = next(
i
for i, record in enumerate(data)
if record['nomeCliente'] == name
)
del registros[index]
Oh, sorry, you need to print a message if the name isn't found?
One sec...
Erm, I'm not sure that's correct.
This is what I would do:
nome = input("Digite o nome do cliente no qual você deseja excluir: ")
try:
index = next(
i
for i, record in enumerate(registros)
if record['nomeCliente'] == nome
)
except StopIteration:
print("Não foi possível encontrar nenhum cliente com nome de", nome)
else:
del registros[index]
Yep
It deletes the record if the name is found.
next will raise StopIteration if the item isn't found.
so i think this will work
Yep
