python-3.x

Find the arithmetic mean of even and geometric mean of odd numbers

I threw something like this, but I can't figure out how to do it further. Tell me please. ''' Use random numbers to generate ... spiska = len(spisok) for i in range(kol_vo_spiska): sp = (spisok[i]) if sp % 2 == 0: print(sp) print(spisok)

Integer division ( / / ) in Python 3

Please explain how integer division works in Python 3. I don't understand one particular example: print(4//3) print(-4//3) A ... get that the result is exactly (±) 1? Because the answers without rounding will be: 1,3333333... -1,333333 ... respectively.

How do I switch to the next array element in a for python loop?

For example, to output 2 elements inside one block: arr = ['one','two','three','four']; for x in arr: ......... print()... Output: one, two three, four

How do I view my payment history in the QIWI API?

How do I view my payment history in my QIWI? I looked at the example in the documentation, but it outputs objects. How do I g ... gt;], 'next_txn_id': 25392721556, 'next_txn_date': datetime.datetime(2019, 9, 22, 23, 44, 47, tzinfo=tzoffset(None, 10800))}

Pyqt5 How to open.an exe file?

I want to open an exe file through a pyqt5 program. I press wait does not start what to do ? Code: from PyQt5 import QtWidg ... f = open('Roblox.exe') app = QtWidgets.QApplication([]) application = mywindow() application.show() sys.exit(app.exec())

When reading a csv file, Pandas does not split the data, but leaves it in the first column

I try to split the data, but pandas leaves everything in the first column. df = pd.read_csv('testdata.csv',sep=',',encoding = ... tach a link to a file that I can't read. Https://drive.google.com/drive/folders/1RJDRRZZN9V8z5nCkFJA89jHzecrRWxBx?usp=sharing

Sending, accepting, and saving large files via socket in python

I'm learning how to send data via sockets now. And I ran into the following error: I can't send a 5 megabyte file via a socke ... times while I was writing the code. I would also like to understand how, and whether it is possible to simplify it at all?

Python Decorator Task

Set a task for Decorators in python at uni The essence is this: There is a function that calculates a certain value and retur ... = c print("Добавили новое значение") i=i+1 Please help me create a function and push everything into the decorator

The inverse of k a modulo m

Reverse number Two integers m and a are given. If there is no inverse number to a modulo m, then print the number -1, and if ... nt, input().split())) b = pow(a[1], a[0] - 2, a[0]) if pow(a[1], a[0] - 2, a[0]) == 0: print(-1) else: print(b)

Why do I need new and what is its practical application?

Why do I need __new__ in Python development and when to use it? Here is a nice comment in 2 words, what is the magic met ... one give a simple example where there is a reasonable use of __new__ and explain why it is needed and when it should be used?

Convert Pandas.The series obtained as a result of grouping, in Pandas. DataFrame

I have a question when working with a table in Pandas. I get everything below #достали из базы данных табличку ... м - 110 17:46 Карп жареный - 240 UPD: I tried to do as in the answer to the question

how to download files from yandex. disk

There is a file: https://yadi.sk/d/xsjJ3dEqb4pvlQ (it's open) how do I download it? no authorization required, etc.

How to implement a chat without a server?

I want to create a simple console chat in a single Wi-Fi network without an internet connection. How can this be done? What should I google?

Some strange text from the file

It is necessary that the program outputs the text from the file in which I wrote something. Here is the code: FILENAME = " ... PS RR SR°R±RS R°RS'( If anything, I use PyCharm Community. The text file was created in the same place as the .py file.

How do I find out the index of a list item?

This is Python 3.7.7 mylist = ['Daria','Anton','Vlad','Kirill'] We need to find out the index of the 'Vlad' element. Help please.

Error IndexError: string index out of range

for i in range(1,101): k = str(i) print(k[5]) else: print('Цикл окончен') How can I output only one (in this example, the 5th) number from the loop? I got the error > print(k[5]) IndexError: string index out of range

How do I disable the discord bot from the voice channel?

There is a problem when disconnecting the bot from the voice chat: import discord import asyncio from discord.ext import com ... InvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'disconnect' How do I fix this?

How do I draw a circle in Tkinter?

shape_id =canvas.create_oval(10,10,10,10, outline="red", fill="green", width=2) How do I set the radius of a circle in canvas? As far as I understand, there is no such attribute here.

Python PyTelegramBotAPI. Checking isdigit in a row

# Start @bot.message_handler(commands=['start']) def welcome(message): bot.send_message(message.chat ... (message, get_height) break else: bot.send_message(message.chat.id, 'Вводите только цифры!')

Please help me fix the Python code

Hello everyone! For a long time I tried to solve one problem. The drunkard game Condition: In the drunkard game, a deck of c ... econd += [a, b] if n == 1000000: print('botva') break else: print('first' if first else 'second', n)