Questions tagged as 'python-3.x'

1
answer

How to do a "compilation" of the code in Python?

Knowing that Python is an interpreted language, is there any way to compile the program in Python? By that I mean, how to check for syntax errors without having to expect such a part of the program to occur for verification. Because errors are o...
asked by 25.01.2018 / 11:17
1
answer

Calculating the maximum value for an expression of natural numbers using Python

Two natural data m and n determine, among all pairs of natural numbers (x, y) such that x < m e y < n, a pair for which the value of the expression x * y - x ** 2 + y is maximum and also calculate this maximum. I solved the problem like this:...
asked by 22.03.2018 / 23:20
1
answer

Print in ascending order the first natural n's that are multiples of i or j or both

Given n and two positive integers i and j other than 0, print in ascending order the first natural n's that are multiples of i or or both. Example: For n = 6, i = 2 and j = 3 the output should be: 0,2,3,4,6,8. n = int(input("Digite n: "))...
asked by 23.03.2018 / 03:55
1
answer

Generate new image centered on a point

I did a rendering and found a dot in the image that meets my criteria. I need to cut the original image into a smaller one (120x120) centered at this point. I tried the following: img = cv2.imread(path,cv2.IMREAD_GRAYSCALE) mx = pegarPontox()...
asked by 18.09.2018 / 17:24
2
answers

Extracting Window Values and Schedules in a Network Dump

The following network dump (PCAP file format) results from the capture of a denial of service attack in the lab: I would like to extract the time (unix time) and window value (win) and save it to a text file in the following format:...
asked by 28.05.2017 / 07:10
1
answer

Code review: Server with threads to handle multiple clients

The server with Threading: import socket from threading import Thread def Servidor(): servidor = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ip = "0.0.0.0" porta = 8884 servidor.bind((ip, porta)) servidor.list...
asked by 09.04.2018 / 19:29
1
answer

What's wrong with this Python code?

I'm trying to create a simple project for study purposes but I'm having trouble completing it. I am using the Pytube library to download videos, I can download the videos but I can not show the download progress bar and the size of the file (v...
asked by 21.04.2017 / 16:30
2
answers

Vectors in Python

Very well, I come from C-thread, and I'm having a hard time creating vectors in python. In C if I wrote vet = [5]; I would create a vector called vet with 5 indices. I wanted to know how to do this in python but I'm a beginner and I can not do i...
asked by 06.05.2017 / 04:23
1
answer

Access dict within list

How do I access the dictionary where it contains the Portuguese language from the list below? To access the key: variavel.foreign_names , but I would like to get the values that are inside the dictionary with Portuguese language (the di...
asked by 16.01.2017 / 18:52
1
answer

Error in code sum beginning with 0; Problem inserting data into .txt file

As you can see in the code below, I tried in several ways to make each inserted product a new code with codigo += 1 , but it is returning:    UnboundLocalError: local variable 'code' referenced before assignment! Placing this line a...
asked by 24.08.2018 / 15:44