Questions tagged as 'python-3.x'

2
answers

What is the correct way to call methods in Python?

What is the correct way to make a method call in Python? As in the example below. def __init__(self): mtd([1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) def mtd(data): for value in data: print(value)     
asked by 09.01.2017 / 19:59
3
answers

Fibonacci running in parallel? Threads?

def recur_fibo(n): """Recursive function to print Fibonacci sequence""" if n <= 1: return n else: return(recur_fibo(n-1) + recur_fibo(n-2)) This code makes the recursive fibonacci "simple" ... Imagine that I called...
asked by 10.08.2016 / 02:57
1
answer

How to modify a Label when writing in Entry in tkinter?

I would like to make a program that detects the change in the Entry text and changes the Label to the same Entry text, how can I do this? from tkinter import * # Configurações da Tela window = Tk() window.title("Hello World") window.resizab...
asked by 17.07.2015 / 16:11
2
answers

How to access the elements of a set?

I'm studying about sets ( set ) in Python because I'm going to use an algorithm to find paths in a graph, it's for a college discipline I'm having. I created two assembly examples using two different notations. Look at the illustration...
asked by 06.09.2018 / 20:59
2
answers

What does "return" do in Python?

What "really" return does in Python, especially in recursive functions. Ex. Factorial: def fatorial(n): if n==1: return n return fatorial(n-1) * n     
asked by 26.02.2016 / 03:32
1
answer

What is the 'reduce' function in Python?

In what cases is it useful and how can I use the reduce function?     
asked by 17.04.2018 / 04:18
1
answer

What does this "point" in Python mean?

What does this point mean between the variable var and index ? Example: var = ['João','Pedro','André','Alice'] var.index('André') Is there a name?     
asked by 21.04.2017 / 15:42
1
answer

How to declare a password input?

I wonder if there is a way to mask character entry in input() of python. Ex: Senha = 1234 Entrada = int(input("Digite sua senha: ")) In the above entry I wanted to change the letters entered by asterisks. Is there any way to...
asked by 31.12.2016 / 22:19
1
answer

What is the asterisk in defining a function in Python? [duplicate]

For example, in the documentation for the module pickle it is common to see such notation: pickle.dump(obj, file, protocol=None, *, fix_imports=True) pickle.dumps(obj, protocol=None, *, fix_imports=True) pickl...
asked by 06.07.2018 / 16:20
1
answer

In Python, how do you explain the expression 'x = not x'

I already know the result, but I would like to understand what happens, why this result ... For example: >>> a = True >>> b = not a >>> print(b) False It's a simple thing, but I feel annoyed to use somethin...
asked by 13.11.2014 / 10:50