Questions tagged as 'python'

1
answer

How to create text in a python image?

I wanted to create a text in an image, with python, to show a variable (either the format), eg: I have an image showing A = 0, then I change a variable, I redo the image and it shows A = 15, how can I do something like this?     
asked by 28.11.2016 / 19:45
1
answer

Error TypeError: a float is required

This is my code: ### BIBLIOTECAS import scipy.special as sps import numpy as np import matplotlib.pyplot as plt import pandas as pd import scipy as sp from scipy.stats import norm from scipy.stats import gamma from math import exp import oper...
asked by 23.12.2016 / 13:16
4
answers

Place items in lists

I would like to have two lists: one with the name of the fruit and another with the colors. lista = ['banana [amarela]\n', 'uva [vinho]\n', 'laranja [laranjado]\n', 'kiwi [verde]\n', 'framboesa [vermelho]\n', 'coco [marrom]\n'] lines = lista....
asked by 13.09.2017 / 15:32
2
answers

Extract multiple values from a single variable in python

If I have a single data entry, can I retrieve multiple values assigned to my variable and rights to the other? representation: vrvl = int(input("Dia.mês.ano: )) dia = dia mes = mes ano = ano #entrada == 22.08.17 print("Dia:", dia) print("Mê...
asked by 22.08.2017 / 13:26
1
answer

calculate media from a list line by line in python

question: Using the text file notas_estudantes.dat write a program that calculates the average of the notes of each student and prints the name and average of each student. file: jose 10 15 20 30 40 pedro 23 16 19 22 suzana 8 22 17 14 32 17 24...
asked by 07.10.2018 / 02:28
1
answer

How does Python handle static and dynamic variables?

Static variable, is the one where we have separated the memory of the computer already beforehand in a defined way (I read this in the book "Basic structure of data"). The dynamic variable is the one in which it appears in the execution of the p...
asked by 16.10.2018 / 18:22
1
answer

Library sys - maxsize

How does this sys.maxsize function work? import sys Menor: int = sys.maxsize What does this expression mean?     
asked by 11.04.2018 / 21:37
1
answer

Doubt: Function of generators

Write your own generator function that functions as the internal enumerate function. Using the function like this: lessons = ["Why Python Programming", "Data Types and Operators", "Control Flow", "Functions", "Scripting"] for i, lesson in m...
asked by 19.04.2018 / 03:55
1
answer

How to rotate an image without knowing the angle of inclination?

My program receives an image of a CNH scanned (with the wallpaper). The goal is to remove the background and leave only the CNH. When the document is upright, no problem, since I can use getbbox, as I did in the code below: import matplotlib.p...
asked by 23.10.2016 / 05:07
1
answer

'dict' object has no attribute 'has_key' in Python3

In Python 2, when I wanted to know if a dict had a given key, I used the has_key method. if kwargs.has_key("code"): self.code = kwargs.code However, now that I was running the same script in Python 3, I got the following er...
asked by 04.11.2016 / 14:01