Questions tagged as 'python'

1
answer

How to join 2 lists in a single Matrix?

Make a program that creates two vectors, using lists, and receives 6 integers in each of the vectors. Finally, the program should create a 3x4 matrix from the interleaving of the two vectors. This merge will occur as follows: Capture two e...
asked by 12.11.2017 / 03:56
0
answers

SQL login and password authentication PYTHON

I'm doing an authentication function to compare login and password with their login and password columns with the following Inthecase,thefunctiondoescomparativewiththeloginbutwhenitexecutesthe'pas'commanditreturnsthefollowingerror:"sqlite3.O...
asked by 12.11.2017 / 15:33
1
answer

Kivy event with keyboard

I'm creating a piano with kivy is working fine, but just with the mouse click on the Button, I want to know how to do when typing a button the Button to be executed without having to click the mouse from kivy.uix.button import Button from kivy...
asked by 27.10.2017 / 19:44
1
answer

Error with PREDICT in Scikit-learn

I recently started learning a bit about Machine Learning and sorting, through a course at Alura. Well, I tried to perform the first exercise, but I could not because of a mistake I can not tell what it is. Here is the code I have and the Error d...
asked by 03.11.2017 / 12:21
0
answers

Error sorting with kmn

I'm trying to sort using kmn, but it's giving the error shown after the code:    File search_datas.py from dados import carregar_acessos from sklearn.naive_bayes import MultinomialNB import os pasta="c:/users/usuario/dados" os.c...
asked by 10.11.2017 / 02:31
1
answer

Indexes of tuples in a list - python

Organizing information in the file (City, City, Distance) import csv with open('cidades.csv', 'r') as f: list1 = [tuple(line.values()) for line in csv.DictReader(f)] for i in list1: x=(list1[i]) print(distancia=x[2]) To a...
asked by 10.11.2017 / 00:27
0
answers

Deep search - python

import csv with open('cidades.csv', 'r') as f: list2 = [tuple(line.values()) for line in csv.DictReader(f)] def dfs_helper(list2, start_city, end_city): pilha = [] visited = [] adj_cities = get_connections(list2, start_city)...
asked by 10.11.2017 / 03:04
1
answer

Error in pyautogui, values

I want to create a macro that performs some tasks. [OK] Step 1: Remember the X and Y . COD: def recordMouse(): time.sleep(5) print "New record in 3s" x, y = pyautogui.position() c = open('Position.txt', 'a') c.write(str(x) + ":" + st...
asked by 23.10.2017 / 17:33
1
answer

I am not able to use get_rect with convert / convert_alpha and subsurface

I was doing this: class Esqueleto (pygame.sprite.Sprite): def __init__ (self): self.imagem = pygame.image.load("imagem/esqueleto.png") self.rect = self.imagem.get_rect() self.imagem = self.imagem.convert_alpha()...
asked by 24.10.2017 / 16:28
0
answers

DTMF sound in python

Can anyone help me with this error here:    y1 = np.sin (2 * np.pi * f1 * t)   TypeError: can not multiply sequence by non-int of type 'float' The full code follows: import matplotlib.pyplot as plt import numpy as np import pyaudio du...
asked by 23.10.2017 / 02:07