Questions tagged as 'python-3.x'

1
answer

Python Method Resolution Order (MRO)

Let's say I have something like this: # -*- coding: utf-8 -*- class Base(object): @classmethod def foo(cls): pass def grok(self): pass class A(Base): @classmethod def foo(cls): print('A')...
asked by 04.06.2018 / 07:38
2
answers

Make a random of a dataset with pandas

I'm trying to extract 15O lines from a 500-line dataset. So I would like to do it at random. My Data objeto,cor,label cachorro,branco,animal manga,laranja,fruta calça,preta,roupa My script import pandas import pandas as pd df = pd...
asked by 23.08.2018 / 23:12
1
answer

How to make a timer in Python 3?

I have to make a timer that counts x seconds, but that does not stay in loop waiting for the time to pass, instead it must count the time and generate an event when closing the count of the pre-defined time. I need to know if there is a module i...
asked by 13.06.2018 / 22:15
3
answers

Inserted into a list of lists in python

I would like to populate a list where each position is a list. lista = [[], [], []] I have an input: 44 45 49 70 27 73 92 97 95 I would like to list the numbers so that the index is mod of each number by 13. Ex: 44% 13 = 5     27% 13...
asked by 22.06.2018 / 04:35
1
answer

Smallest element of a sub-list, in a list

I'm trying to apply heuristics to a code I've been working on right now, but I need to get the smallest element of a list from a list. example: L = [[1, 1, 6], [1, 2, 5], [1, 3, 7], [2, 1, 1], [2, 2, 9], [2, 3, 4], [3, 1, 5], [3, 2,...
asked by 30.07.2018 / 02:58
2
answers

How to transform a list into set in Python?

I'm trying to intersect the player list with the computer list, but I'm getting an error that goes like this: "line 13, in print (set (player) .intersection (computer)) TypeError: 'int' object is not iterable ". Would anyone know where I'm go...
asked by 25.05.2018 / 02:52
1
answer

How to print information in table format in python?

I would like to print the results in the table format as attached image. In the code I'm doing it is to literally reproduce the above funding system. But when I go to test, they print one below the other and I do not know how to print next...
asked by 20.06.2018 / 02:10
1
answer

switching from one entry to the other when entering a word

People, help me with this, I have two entry and I need when I type a word for example (Python) it changes from one entry to the other automatically from tkinter import * janela2.geometry('250x250+100+100') lb2 = Label(janela2, text='coloque...
asked by 17.06.2018 / 15:56
2
answers

block Try and except

I need to run this program: Rewrite your payment program using try and except for the program to handle non-numeric inputs amicably by printing a message and exiting the program. The following shows two program implementations: Digite as Ho...
asked by 20.06.2018 / 11:04
1
answer

How to install packages in pip without internet access?

I'm having trouble with python. I'm rendering service for a bank, but the network is very closed, I can not download the files via pip . I can download the packages in a different way but I can not get them to run, can someone help me?...
asked by 20.07.2018 / 06:15