Questions tagged as 'python'

1
answer

Generate 9-digit keys with Python

I would like to generate several values following the pattern XXX-XXX-XXX where all the possibilities will be generated, for example: 1 - 000-000-000 2 - 000-000-001 3 - 000-000-002 . . . x - 999-999-999 . . . x - 000-000-00A x - 000-00...
asked by 18.12.2017 / 23:04
2
answers

How does Python maintain the same memory reference of a list after resizing it?

We know that objects of type list , because they are based on dynamic vectors, have a maximum internal capacity. We also know that when full capacity is reached and we want to insert a new value into the list, Python allocates a new array...
asked by 10.10.2017 / 17:10
2
answers

Extraction of datetime object value in Python.

I need to extract only the time of a datetime object. How to proceed? The object returns the following output: "3 days, 22:01:00"     
asked by 19.10.2017 / 01:49
2
answers

Correct incorrect module return [duplicate]

Mathematically speaking why it happens and how to correct the following "error" in python: >>>10.53 % 1 0.5299999999999994 I'd like to understand how python works to get this value, why this occurs. In fact the duplica...
asked by 13.10.2017 / 06:26
1
answer

Use from module import * vs use import module in python 3

The two do the same thing (I think at least), but I've always been told that import module is better so I've always used this method, but the / strong> leaves the code more concise since you do not have to be calling the module all the time....
asked by 29.10.2017 / 16:45
1
answer

Identify repeated elements in list with Python

The list I made should read the repeated values from a list and show their positions, but it did not work correctly lista = [] listaRepetido = True for i in range(4): lista.append(int(input("Numero: "))) for i in lista: for j in rang...
asked by 28.06.2017 / 22:44
2
answers

Python 3 make the program discover how much of a given digit has a string or a number

It's for python 3: I'm trying to do a pretty basic program to figure out how much of a given digit it has in a string or a number. For example, if the user types 1200, I want to print- "your number has 2 zeros" .... or if the user types "h...
asked by 25.08.2017 / 07:55
2
answers

Estimating the response time of a server using Python or regex

I created a virtualized environment with an Apache server (running in Debian) and several attacking machines running Debian as well. We used VMware Workstation. Server IP: 192.168.91.5 I have dump file (PCAP) collected with tcpdump. Is the...
asked by 20.09.2017 / 18:18
1
answer

Associate two lists in python

Associate two lists, a list with car name and another list of colors and each one containing n elements: listaCarros = ["gol","uno","corsa","palio","idea"] listaCores = ["branco","verde","preto","cinza","azul"] with the output in this forma...
asked by 23.09.2017 / 17:58
1
answer

Type set in Python is ordered?

When creating a variable like this: a = {1,2,5,1,3} It ends up returning a variable of type set . However, in the Python documentation, it is said that it is impossible to create a set without the set() function. Also,...
asked by 06.06.2017 / 15:36