Posts by fabincarmo • 26 points
6 posts
-
0
votes2
answers73
viewsA: Error in a function that returns an AND of two variables in python
a = "11001100" b = "01101100" def p_and(a,b): aux=[] for i in range(8): aux.append(int(int(a[i]) and int(b[i]))) return aux print (p_and(a,b)) …
-
1
votes1
answer97
viewsA: Problem with SWITCH
In the switch-case structure, keys are missing. switch(menu) { case 1: printf("Digite um numero para verificar se e primo: "); scanf("%i",&num); primo = 0; for(i=1; i<=num; i++)…
-
0
votes2
answers684
viewsA: Tkinter - How to save Entry() string
Follow the code that worked here. I reversed the "pack" line order and the "Insert" line order, and in the "save" function, I used "name_pl.get()". def criarPL (): global nome_pl def salvar(): arq =…
-
0
votes2
answers807
viewsA: Counting frequencies in a list
If it’s no problem, you could use the numpy module. Follow the code: import numpy as np def frequency(my_list): freq = {} # Função "unique" retorna um array com todos elementos existentes # uma…
-
0
votes9
answers23719
viewsA: Inverting sequence (PYTHON 3)
The code stays in the loop while n is non-zero, leaves when n=0 and does not add zero to the list. Follow the code seq = [] #inicia n com 1 para entrar no loop n = 1 while n: n = int(input("Digite…
pythonanswered fabincarmo 26 -
0
votes4
answers931
viewsA: Python columns excel csv
Here it worked that way. Would that be? import random c1 = (random.choice([9, 9])) c2 = (random.choice([1, 1])) c3 = (random.choice([9, 9, 9])) lista = [] print ('---criado por xxx---') rc = int…