Questions tagged as 'python-3.x'

0
answers

voice recognition with Python 3 [closed]

I'm developing a desktop application, I need to use speech recognition, but all the stuff I think is Python version 2. Does anyone know how to do this using libraries for Python 3?     
asked by 21.12.2016 / 23:28
2
answers

Why in Python 0.03% 0.01 = 0.009999999999999998 and not 0?

>>> 0.03 % 0.01 0.009999999999999998 Why do you give this result, the rest of the division being 0? And also, instead of 3, give: >>> 0.03 // 0.01 2.0     
asked by 26.06.2018 / 16:28
2
answers

Generate float values between -1 and 1

I am trying to generate float values between -1 and 1 to test if they are within the defined limits in order to create a vector with the amount of data I want only that I am only able to generate% between 0 and 1 through the function f...
asked by 23.11.2018 / 10:01
2
answers

What determines a variable as an array in Python?

I'm studying about queues in Python and I'm using the object deque of the module collections . So, in Python I can access the values of an array by index simply by typing: array = [1, 2, 3] arra[0] # 1 However, the deque o...
asked by 04.09.2018 / 21:14
3
answers

How to start a range from 1

I wish that in the    input ("Put the student's note" + str (notes) + ":") The computer asks " Put student grade 1: " and not starting from 0, how to do this with the range function? Code below. Alunos = int((input("Digite quantos al...
asked by 13.05.2017 / 05:47
2
answers

Class return key and value of my attributes

I have the following class: class RegC100: def __init__(self,linha): def convFloat(valor): if (valor != ''): valor = float(valor.replace(",", ".")) return valor else:...
asked by 24.01.2017 / 13:32
2
answers

square root "perfect" in python and identify the rest:

It's for python 3: What I'm trying to do is show the rest of a square root account that only accepts the largest integer possible in response. For example: import math x=math.sqrt(87) print(x) This code returns 9.327379053088816, I wan...
asked by 26.08.2017 / 09:32
2
answers

Error in "utf-8" in python 3

I'm having a problem with python 3 in the code: #!/usr/bin/env python #-*- coding: utf-8 -*- import urllib.request page = urllib.request.urlopen("http://beans-r-us.biz/prices.html") text = page.read().decode('utf8') print(text)' Give e...
asked by 06.11.2016 / 21:59
4
answers

How do I organize each position in my list in ascending order?

This is my code: a = [[3,2,1],[4,3,2],[5,4,3]] for i in range(0, len(a)): for j in range(0, len(a[i])): a[i].sort() print(a) The problem is that you are only organizing the first position. Could someone give me an orientation...
asked by 04.08.2018 / 04:15
2
answers

How to implement a recursive MDC calculation algorithm in Python?

The non-recursive version is below: def mdc(a,b): while b !=0: resto = a % b a = b b = resto return a print(mdc(50,2)) A recursive attempt would be: def mdc(a, b): if b == 0: return a rest...
asked by 19.04.2018 / 15:23