Questions tagged as 'python'

2
answers

Print data from a dictionary in Python

How do I print data from a dictionary each in a column? For example: lanchonete = {"Salgado":4.50, "Lanche":6.50,"Suco":3.00,"Refrigerante":3.50,"Doce":1.00} for m in lanchonete: print (m[0]) I want to print the snacks on one column...
asked by 05.11.2018 / 15:26
3
answers

why does not this equation compile?

import math def f(x): eq = (4-8*x)*math.cosh(2x) return eq a= 0 b= 1 erro = math.pow(10,-3) if f(a)*f(b) < 0: x=(a+b)/2 while (math.fabs(f(x)) > erro): x=(a+b)/2 if f(a)*f(x)<0: b=x...
asked by 07.12.2018 / 01:59
2
answers

Error formatting string for datetime python

I'm trying to format a string with the format "2018-05-09T05: 05: 34Z" to "05/05/2018", but given the error ValueError: unconverted data remains If I use: dataAntiga = "2018-05-09T05:05:34Z" datetime_object = parser.parse(dataAntiga)...
asked by 04.06.2018 / 03:44
1
answer

Error in sql-insert command when passing variable as parameter (python 3)

I am trying to pass my "table" variable to the mysql command, however it is returning an error (from sql) during execution. What am I missing? Here I created the variable table table = input ('Table name:') while(tabela not in tabelasCad...
asked by 28.09.2017 / 21:53
2
answers

Reading files without a blank line

How do I avoid reading a blank line in a file, for any operating system, using the Python language?     
asked by 08.08.2016 / 01:58
2
answers

SyntaxError: unindent does not match any outer indentation level

What should I do when this error message appears: "SyntaxError: unindent does not match any outer indentation level"? I can not declare the else of the variable. Here is a print of the problem and the code: escada = 'Sim' if escada == 'S...
asked by 29.08.2017 / 00:12
4
answers

Program to find MMC in Python

I was doing a basic exercise for the While function, it asked to create a program that found the MMC between 2 numbers ... I could do it, but the program continues to print the answer non-stop in loop . Where did I go wrong? num1 = int...
asked by 14.09.2017 / 01:43
3
answers

How to simplify these two methods?

Well, in my class there are two magic methods, add and sub: def __add__(self, other): if other.__m == self.__m and other.__n == self.__n: result = [] for i in range(other.__m): lst = [] for j in ra...
asked by 04.12.2018 / 22:21
2
answers

How to use a function inside another function in python3?

I wanted to get the result of the input of the function name and use inside the intro function, however the way I'm trying, I get only one error. code: def nome(): name = str(input('Poderia nos dizer seu nome? ')) return name def i...
asked by 23.11.2018 / 19:16
2
answers

LaTex and Python integration or R [closed]

Hello, I have a project that involves automating reports. Currently all reports are made through word and graphics in excel, now I'm trying to deploy an application that automatically generates the graphics in linguagem R and I wanted the...
asked by 12.03.2018 / 19:07