Questions tagged as 'python-3.x'

1
answer

Python pandas formatting

import numpy as np import pandas as pd ID = [i for i in range(1,101)] def tabela(imc): if imc < 18.5: return 'Abaixo do peso' elif imc < 25 and imc >= 18.5: return 'Saudável' elif imc < 30 and imc >= 25:...
asked by 09.01.2018 / 02:52
1
answer

Put N values in order

I need to make a program that reads n numbers (undetermined quantity) and then put them in order. The stop condition is the number 0. I thought about throwing these values to a list and then sorting them. I made a while loop, however,...
asked by 24.12.2017 / 01:28
1
answer

Type error: not all strings converted during formatting

I'm trying to make a couple or odd game. The problem is that every time the sum of my play with that of the computer gives 'par' this error message appears. I've tried other types of formatting and the same error always appears. Also, this line...
asked by 18.12.2017 / 01:22
1
answer

Read data from a SQLite 3 database in Python

I'm starting in Python and database and I've had three doubts! For example, inside my database I have a "name" column. Just to illustrate, let's say I want to get the contents of the "name" column corresponding to id = 1 and play on a Pytho...
asked by 15.12.2017 / 03:40
1
answer

search script - python

The problem is that I can not separate arquivo_novo from /root/arquivo_novo , as indicated below. I just need the "new_file" to be able to get into the LOOP IF and the system returns /root/arquivo_novo and never enters the...
asked by 13.12.2017 / 16:41
1
answer

Error: unhashable type: 'dict_keys', how to solve?

I have a code that accesses a CSV file through a function. I created a second function to change the name of the column header (changeName) and to not have to call it several times changing the parameters of "columnIngles" and "columnPortugues"...
asked by 26.11.2017 / 02:01
2
answers

Python 3 - Problems with date of birth

Good evening, the down code in python3 should return a monthly amount according to the client's age, I used the time module to get the client's age when he informed his year of birth, thinking about the possibility of the user informing a year o...
asked by 25.11.2017 / 23:34
1
answer

Renaming file: 'str' object has no attribute 'group' [closed]

I have a problem that may be very trivial but I can not understand. I found in a text by regular expression a number sequence of type XXXX / YYYY, after that I need to rename the .txt file with the sequence found. The problem is that when trying...
asked by 21.11.2017 / 12:16
1
answer

pyautogui compare result CTRL + V

I have the following code import pyautogui pyautogui.moveTo(612, 269) pyautogui.doubleClick() copiar = pyautogui.hotkey('ctrl', 'c') colar = pyautogui.hotkey('ctrl', 'v') resultado = colar print(resultado) but my print is returning "None"....
asked by 24.11.2017 / 18:22
1
answer

Separate input value and expected value in pytest.mark.parametrize

How do I separate the parametrize, the expected input @pytest.mark.parametrize('entrada, esperado', [(1,0,0,), (1,0,) ]) def testa_raizes(entrada, esperado): assert b.calcula_raizes(entrada...
asked by 14.11.2017 / 12:11