Questions tagged as 'python'

1
answer

Indentation in Python [duplicate]

I would like to know where I could put blanks to separate parts of the code according to PEP8. q = int(input('Quantos números sua sequência tem?(3 ou mais)')) if q < 3: while True: q = int(input('Quantos números sua sequência...
asked by 16.01.2018 / 16:25
1
answer

Python CSV How to rewrite only one line of the file?

I have a line that stores the following columns inside the file: ID Nome Telefone Descrição DataEntrada HoraEntrada The ID is basically the line number and it's through it that I'm going to search what line to rewrite. I know that p...
asked by 28.11.2017 / 14:45
1
answer

Vector of objects in Python

I want to create a Node class, and one of its attributes is a vector of Nodes (as in a linked list). Since Python does not declare the attribute type, I have no idea how to do it.     
asked by 03.02.2018 / 06:03
1
answer

Python URI Error - 2588 - Palindromes

As I upload my code to URI Online Judge (problem 2588) , give a error, and I can not fix it at all. The statement is this: Andmycodesentwasthis:entrada=input()letras_unicas=set([iforiinset(list(entrada))ifentrada.count(i)%2!=0])iflen(letras...
asked by 14.12.2017 / 15:10
1
answer

Turning a python function into a function in PHP

Would anyone know how to turn this python function into a function in php? def createSignature(clientId, apiKey, privateKey, nonce): message = str(nonce) + str(clientId) + apiKey signature = hmac.new(privateKey, message, digestmod=has...
asked by 16.12.2017 / 17:21
1
answer

Second command does not work [closed]

I was testing the conditions, but when I use one command and then another, the second is not working. c=str(input('')) if c == '/tutorial': print('ok, como vc é um hacker vc hackea td por comandos, para saber seus status vc precisa digita...
asked by 18.10.2017 / 03:02
1
answer

Invalid syntax message with no apparent error

I'm trying to rename a folder that has a set of files, I want to remove all the digits from the file names. But when I try to run the code the error message appears: "invalid syntax", pointing specifically to the os module. Can anyone tell me th...
asked by 02.10.2017 / 22:39
2
answers

using the 'any' function in python

I have 2 lists with multiple landline / cellular numbers. Example: Lista 1: ['0169924233316','01687665544','01978553322']<br> Lista 2:: ['0169924233316', '01788226541']<br> Within a for, I compare the 2 lists to find if there i...
asked by 16.10.2017 / 13:16
1
answer

Python prime numbers | while [duplicate]

I have the following problem: Write the largest_primo function that receives an integer greater than or equal to 2 as a parameter and returns the largest prime number less than or equal to the number passed to the Note that largest_...
asked by 17.10.2017 / 17:09
1
answer

False error when opening decrypted document with Crypto library of Python 2.7.9

I tested the following script in Python, using Python 2.7.9, with some adaptations made by me, available at link : # Cifra e decifra documentos nos formatos .pdf, .docx e .rtf # Adaptacao de Marcelo Ferreira Zochio from Crypto import Random...
asked by 30.10.2017 / 18:37