Questions tagged as 'python-3.x'

1
answer

How to concatenate strings in a list? [duplicate]

If I have a list of string objects and want to concatenate all these items, how do I do this?  For example: row1 = ['___', '___', '___'] I would like to print: '___|___|___' I've been able to do this, but it's not very p...
asked by 22.11.2018 / 12:47
4
answers

Place only the correct message print once

I'm doing this program:    Develop a program that asks you to enter a CPF number   in the format xxx.xxx.xxx-xx and indicate if it is a valid or invalid number through   verification digits and formatting characters. The code is th...
asked by 28.06.2018 / 12:56
1
answer

Code evaluation: Logistic regression with K fold validation. Is correct?

The code below is an attempt to do a logistic regression with k-fold cross-validation. The idea is to take the confusion matrices generated in each fold and then generate a mean confusion matrix with 95% confidence (confidence interval for the m...
asked by 29.06.2018 / 01:36
1
answer

How to detect a click or other mouse event in NotifyIcon from win32gui?

I'm trying to modify the win10toast library so that I can pass a callback that runs when the user clicks on the Windows 10 notification that I show. The "meat" of the library, which I condested as much as I could to create a minimal...
asked by 30.06.2018 / 23:59
1
answer

How to get the items that multiple lists have in common

How do you do when there is no common item, posting notices? Listing 1, 2, and 3 have different index numbers. def compabilitySorter (lista1, lista2, lista3): listCompatible=[lista1, lista2, lista3] checkedItem=set() commonIt...
asked by 12.12.2018 / 13:42
1
answer

Class definition within a function or another class

I've seen in some scripts definitions of classes within other classes or functions like this: class Grok(object): class Foo(object): ... ... What is the reason for this practice? Is it just to not allow direct instantiatio...
asked by 09.07.2018 / 06:46
1
answer

Exception handling of type EOFError

while True: try: x = input().split() l.append(x) except EOFError: break I have a problem in this code where I can not get an EOF of x, because if I do not type anything and just hit enter, it still receives the...
asked by 05.07.2018 / 17:37
1
answer

Constructor method in inherited classes

Using Python3, what would be the constructor method of the Z class? class W: def __init__(self, atributo1): self.atributo1 = atributo1 def metodo1(self): print("Metodo1") class X(W): def __init__(self, atributo1...
asked by 03.09.2018 / 22:53
2
answers

Read a csv file and add your data in a dictionary

I have a code where I will have a function that will pass the data from a csv file to a dictionary. The process will take the movies with their respective notes and add to a dictionary relative to each user, and add those dictionaries to a main...
asked by 08.09.2018 / 01:50
1
answer

How to insert a counter of attempts within a Python 3 exception (except ValueError)

Hello. I am a beginner in programming and I have been trying to develop programs that I have learned in programming book exercises on my own. I did my version of the classic "Guess the number", where the user has (n) attempts to hit a number ran...
asked by 24.07.2018 / 20:11