Questions tagged as 'tupla'

1
answer

Python file transfer, client-server

I have a problem with my code, I need to develop an application that is able to send a file to a server and also can recover files from the server I am using a tuple to send the data to the server nome = input('Digite o nome do arquivo a ser e...
asked by 06.04.2017 / 20:05
1
answer

Dou function def with input in tuple mode

Good person I have the following code: def tuplas(x): return x[::2] tuplas(('Hello', 'World', 'estamos', 'vivos')) This code will work perfectly, but if I remove the parentheses from my tuple, obviously python will fail: Typ...
asked by 05.11.2016 / 00:38
1
answer

Complex operations with Python (pygame.math.Vector2)

I'm learning Python and came across a complex expression that derives from pygame.Vector2 : import pygame x = pygame.math.Vector2(1,2) b = x * 5 - (1, 2) print(x) print(b) Result: [1, 2] [4, 8] In the above case, the same x *...
asked by 29.09.2018 / 03:13
1
answer

Database in tuple

I need a code that receives data (values) and prints them according to its key. Each entry corresponds to a hypothetical person's data, which contains Age, Name, Sex, Marital Status, Number of friends and Number of Photos. I am writing using a d...
asked by 27.04.2016 / 15:09
1
answer

How to add elements in the tuple using a function?

def funcao(): int(input('insira um número:')) tupla = (funcao(), funcao(), funcao(), funcao()) print(tupla.count(9)) print(tupla) insira um número:9 insira um número:9 insira um número:9 insira um número:9 0 (None, None, None, None) P...
asked by 28.10.2018 / 05:15
1
answer

How do the elements of a tuple be the arguments of a function in python?

First I'll summarize the problem and then explain what I'm trying to do. If you can answer the problem in a nutshell, you do not even have to see the rest. Is there a way to pass the elements of a tuple as arguments to a function? For example:...
asked by 08.05.2017 / 02:09
1
answer

Sort tuple by key in Python 3

I have a lista_tupla = [(1, [1, 2, 3, 4]), (2, [5, 6, 7]), (3, [7, 8, 9]), (3, [10, 11, 12]), (4, [13, 14, 15])] where the first index of each tuple is a key and the second index is a list as above. I would like to know: how do I sort...
asked by 17.07.2016 / 18:27
1
answer

How to create tuple with key receiving value?

I would like to create a method that returns the Django ORM FILTER parameters. I will have to use these filters at different times, I would like to create this generic method. Here's the example: def home(selected_page=None): _config = Con...
asked by 05.02.2018 / 18:22
2
answers

What is the main difference between a Tuple and a List?

What are the differences between Tuple and List in Python ? Example: >a = [1, 2, 3] # [1, 2, 3] >b = (1, 2, 3) # (1, 2, 3) The Tuple , grotesquely speaking, is a constant that accepts List ?     
asked by 03.03.2015 / 16:12
0
answers

How to access the elements of Tupla?

How to access the elements of this tuple: StringElement('24929426', attributes={'IdType': 'pubmed'}) I want to extract the attributes: '24929426' 'IdType': 'pubmed' The snippet of code that generates this output: >>> from Bi...
asked by 21.11.2016 / 15:42