Questions tagged as 'python'

1
answer

bug in program

def trianguloPascal(n): lista = [[1],[1,1]] for i in range(1,n): linha = [1] for j in range(0,len(lista[i])-1): linha += [ lista[i][j] + lista[i][j+1] ] linha += [1] lista += [linha] return...
asked by 25.07.2018 / 21:49
2
answers

Not all arguments were converted during string formatting. What does that mean?

f=open("arquivo.txt", 'w') I am making a code to plot a Gaussian on the random walker (Statistical Mechanics) and is giving this error when saving my "count" file. Here's the code: for j in range (0,t): count=0 for i in range (0,100)...
asked by 20.08.2018 / 13:17
2
answers

How do I get the program to show all the combinations and then the number of combinations that were formed? [closed]

What I already have so far: from itertools import permutations word = str(input()) for subset in permutations(word,len(word)): print(subset)     
asked by 21.10.2017 / 21:58
3
answers

Calculate the sum and mean of a numerical sequence

Following 3,5,7,9,11,13,15. Find the pattern of the sequence and: a) Make a program to display 12 values of this sequence started by 3. b) Show the sum of 'ALL' values (12 values). c) Show the average value of 'ALL' values (12 values)....
asked by 19.06.2018 / 15:39
1
answer

line 17, in module print (f '{a [str (x)]}: {str (n) [r-c]}'

# variaveis a = {'0': 'Milhar', '1': 'Centena', '2': 'Dezena', '3': 'Unidade'} x = int(0) # Variaveis while True: n = str(input('Digit a number: ')) if n.isnumeric(): n = int(n) break else: print('Apenas numer...
asked by 25.01.2018 / 22:45
1
answer

How to improve my code? [closed]

from random import randint from time import sleep import sys def processar(): print("Processando...") sleep(3) print() def voltar(): print("1 - Voltar ao inicio") print("2 - Sair") while True: opcao = int(input("...
asked by 27.08.2017 / 17:51
1
answer

Reverse order commands / upper / switch [closed]

I'm doing a job (Python 3) and I need help completing the codes. I need to know how to reverse the order, for example 2345 in and out of 5432. I also need to know how I leave only one uppercase letter and the smallest case, such as: sta...
asked by 22.08.2018 / 22:17
1
answer

Python error accent

Python is displaying a list of characters with a character error: Normal List 19/01/2017 13:35 ARQUIVADO DEFINITIVAMENTE 03/11/2016 10:55 EXPEDIÇÃO DE DESPACHO 03/11/2016 10:52 CONCLUSOS PARA DESPACHO 03/11...
asked by 28.08.2018 / 00:39
1
answer

SYNTAX INVALID ERROR [closed]

The code below is giving invalid syntax error. Follows: while(escolha!=0 and confirmar!=0): print("Menu") print("1- Inserir um item") print("2- Remover item") print("3- Listar todos os itens") print("4- Buscar um...
asked by 30.08.2017 / 20:08
1
answer

Selecting different intervals in a giant dataframe in RStudio

I have a large CSV with large stock dates and their closing prices, impossible to use Excel. The action name is in the same column as the date and only appears at the beginning of the series, as shown below: I have limited knowledg...
asked by 07.12.2018 / 16:17