Questions tagged as 'python-3.x'

1
answer

Parallel sorting algorithm Odd-even sort in python

I created the following serial code to perform the Odd-even sort ordering, which first sorts the odd / even and odd / even indices. import time def oddevenSort(x): sorted = False while not sorted: sorted = True #orden...
asked by 20.06.2017 / 21:30
4
answers

Is there any way to comment Multiple lines in Python?

To comment on a line, we use # . I would like to know if you can comment on multiple lines in Python 3. If yes, how should I do it?     
asked by 22.01.2018 / 18:35
1
answer

What is the functionality of the "heapify" method of the heapq module?

What is the heapify method of the heapq library of Python? How could I use it in a list, for example?     
asked by 17.10.2017 / 03:35
1
answer

How to read stdin in python?

Using netcat to monitor a certain port on my device using the shell command terminal, I can check the data received by it and send data back to the connected device, such as a chat system with sockets. My question is, with replicating the same "i...
asked by 31.10.2018 / 14:12
2
answers

How to import an xls file into Python?

I'm starting my studies in Python and would like to import a database that is in .xls to Python. Could someone help me? NOTE: Python version 3.4.3.     
asked by 08.04.2015 / 00:06
3
answers

What does it mean to put the 'as' command after the 'import' command in the code below?

The 'as' is in the send_to_twitter (msg) function import urllib.request import time def send_to_twitter(msg): import twitter as t: CONSUMER_KEY = '1wrnsF5lB8fEWVzRdvlIqdTle' CONSUMER_SECRET = 'eTiylDUHLJgGnTCcxzzCtzHXG4OlHrbY6wLvu...
asked by 06.01.2017 / 22:15
3
answers

TypeError: not all arguments converted during string formatting (Python 3.4)

I'm new to programming and trying to make a simple exercise code to calculate a phone bill: t = float(input('Digite a quantidade de minutos gasta: ')) if t < 200: p = t * 0,2 if t >= 200 and t < 400: p = t * 0,18 if t >= 4...
asked by 22.02.2015 / 13:23
1
answer

Methods "__" or "Dunder" in Python, which are the most used?

In Python there are "Magic" methods, such as __len__ , which allows the use of len (object), in addition to that in specific, which are the others most used that can facilitate the use of the structure? >     
asked by 10.01.2017 / 15:57
1
answer

Combine all x, y, z coordinates of a list of tuples

I have the following list with several points: [(14, 9, 7), (11, 1, 20), (1, 1, 7), (13, 9, 1), (9, 13, 4), (20, 1, 4), (17, 6, 8), (14, 10, 1), (14, 2, 17), (7, 20, 7)] Each element of the list is a tuple with the coordinates (x, y, z), wh...
asked by 06.01.2017 / 15:14
2
answers

How to print a txt file in Python

How to print a txt file in Python? I'm not referring to print but rather to print to the printer. Thank you (:     
asked by 20.05.2015 / 21:03