Questions tagged as 'python'

2
answers

Identify the day of the week of a certain date

One of the questions of a college assignment is giving work for the whole class, so far no one has been able to answer question 4. A friend of mine tried with this code, but it does not work right, because depending on the entries, the month leav...
asked by 27.04.2018 / 02:41
1
answer

Remove indent spaces from a list

In the list below, I want to print only the genre of each index, which I actually can, but as you can see there are 4 lists that are without gender definition, which causes when printing several spaces . I would like to print the genres in a mor...
asked by 02.05.2018 / 16:57
1
answer

Use variable of a function in another python function

I want to pull what's in the 'file' variable in the 'function' function and play in the 'send_email' function filename, how can I do that? def function(event): arquivo = open('log.txt', 'a') global janela if...
asked by 06.06.2018 / 01:43
2
answers

Arrays in Python - Concatenate

Hello, I have two arrays and I would like to concatenate them, ie, put a matrix A and B on the other side of the matrix, in the case of forming a 3x6 matrix, but using a loop ("for" command) for this. can you help me? Thank you. matriz_a = [...
asked by 01.06.2018 / 18:23
1
answer

Check the largest prime number - using only while and if

I'm having trouble solving an exercise in logic, I think I'm thinking wrong: What I need: Given an N number show the largest prime number up to N. The code I've made so far is this: def maior_primo(n): print(ePrimo(n)) def ePrimo(k...
asked by 14.11.2017 / 19:25
2
answers

Print of the result of a ternary operator

How to show the output of a ternary operation next to a string, using Python? I want to check if the size of the name you typed is greater than "Braga". For this condition, I want to use the Python ternary operator to check if it is "larger"...
asked by 22.11.2017 / 14:22
2
answers

What are the statements placed before strings?

In python, I noticed that these "statements" were placed in two cases, first, in strings before passing through a hash algorithm, eg:    import hashlib       m = hashlib.sha256 ()       m.update (b "Nobody inspects") Note: The reference...
asked by 03.09.2017 / 19:32
2
answers

Pandas can not find file

I'm using Pandas in Python to read a CSV file that is on my computer, but an error message appears, it does not seem to find the file: import pandas as pd reclamacoes = pd.read_csv("C:\Users\Reinaldo\Documents\Jornalismo_de_dados\Justica\r...
asked by 27.08.2017 / 21:46
2
answers

How to make a nested FOR?

I'm opening two files, one is a text, and the other is a list. I'm wanting through for nested to check how many times each list item appears in the text. I did so: arquivo = open('texto.txt', 'r') lista = open('lista.txt', 'r') for item in...
asked by 22.08.2017 / 21:58
1
answer

Which class should the text class inherit?

When using pygame it is very common that user classes inherit from pygame classes, for example a class of characters usually vaqi extend the class pygame.sprite.Sprite. But is a text class could inherit from which pygame class?     
asked by 25.10.2017 / 01:51