Questions tagged as 'python'

1
answer

Creating an executable file from a python program in windows 10

I am a Linux BackBox user but I need to generate an executable for a program written in Python. I installed Windows 10 Pro on VMWare with Python 2.7 and Python 3.4. I use IDE Pycharm and IDLE. I installed pyinstaller through pip, but when I try:...
asked by 04.08.2016 / 00:10
3
answers

How to use "while not in" in Python?

I tried looping while to check if a condition was met. If the user types 0, 1 or 2 the program should stop asking the user which number he will choose. If the user chooses a number other than 0, 1 or 2, the program will ask the user which number...
asked by 22.05.2018 / 19:25
2
answers

Calculate the age group of 10 people within a loop of repetition?

Below is the code I'm using, it has the following error: SyntaxError: invalid syntax maycon@maycon-H14SU08:~/Documentos/Algoritimos$ python3 prova_lista.py File "prova_lista.py", line 23 elif 18 pessoas <= 65:    Make a program th...
asked by 30.10.2018 / 20:11
1
answer

How to inform parameters to the initializer of the parent class with Python?

Hello, I'm doing inheritance in python and am encountering the following error:    TypeError: __init__() takes exactly 2 positional arguments (4 given) class A(): def __init__(self,a,b): self.a = a self.b = b c...
asked by 18.09.2018 / 12:44
2
answers

How to make the inversion of what is received by adding a comma?

Program that receives a name through keyboard and should print the surname, first name and other abbreviated names eg receives "Luis Costa Santos" and returns "Santos, Luis C." lista = [] nome = '' answer = '' i = 0 while answer != 'n': n...
asked by 01.10.2018 / 22:03
3
answers

Error calculating a loop value

#O usuário informa o número de alunos totais na sala, em seguida são declaradas as variáveis que complementarão os loops alunos = int(input("Qual o número de alunos na sala?\n")) notasAlunos = [] count = 0 #loop de armazenamento de notasXalunos w...
asked by 27.03.2018 / 21:39
2
answers

Compare values in a list of tuples [duplicate]

lista = [('Maria', 28, 7.0), ('Ana', 30, 9.0), ('Thiago', 30, 9.0)] resultado = [] for i in lista: if i[2]<i[2]+1: resultado.append(i[0]) print(resultado) Correct output: Ana, Thiago, Maria My output is Maria...
asked by 09.04.2018 / 21:03
3
answers

How to find numbers greater than X in a list

As an example, this code there N=[1,2,3,4,5] B= #quantidade de números maiores que 2 print(B) 'B' would be the number of numbers greater than 2 in the list, for example.     
asked by 23.09.2017 / 03:02
2
answers

Singleton Pattern in Python

I was seeing this article on how to create singleton classes in Python (among many others), I found it unnecessary for so much programming technique for a really simple thing. Of course I may be wrong. But if I do this, for example class Tes...
asked by 23.05.2018 / 19:22
3
answers

convert a string list to a list of integers

x = ['443' , '552' , '342' , '368' , '9867' , '335' , '9412' , '7436' , '1692' , '85' , '990' , '332' , '8816' , '4567' , '279' , '119' , '2290' , '234' , '9863' , '345' , '230' , '5574' , '230' , '5432'] How can I convert this list to a new...
asked by 22.05.2018 / 21:45