Questions tagged as 'python'

1
answer

Raspberry Pi lights the wrong led

I'm doing an experiment in which I light a green led or a red led according to the result of a question. I'm sure the problem is not the circuits, because I've tried in several ways and it always happens the same: the led that is lit is always r...
asked by 19.12.2018 / 19:33
2
answers

Geometric Progression in python [closed]

Help me make a geometric progression in python that reads an initial value and a ratio and prints a sequence with 10 values.     
asked by 14.06.2018 / 21:52
2
answers

Removing unnecessary question mark from a String

I have possible strings, where I would like to have a way to prevent unnecessary question marks and add if it is missing. However, this function applies only at the end of the string. Here is the list below and the expected result: Possible...
asked by 27.08.2018 / 23:50
2
answers

Get the list of prime numbers smaller than N

I have an exercise in which I need to enter a number (N) and calculate with Python which are the numbers less than N that are prime. This is the code I have now. num == int(input("Insira um número: ")) while num < 0: num == int(in...
asked by 17.05.2017 / 21:24
1
answer

help on request

I'm writing a subdomain scan and I made the following code (sorry to make you cry with it): import requests while True: url = raw_input("url: ") lista = ['blog', 'ftp', 'cpanel', 'intranet'] for list in lista: url2 = url.replace("www",...
asked by 18.06.2018 / 04:21
2
answers

Call function list in python 3

I am creating a script for my python course. The script receives as input a sequence of integers terminated by zero and returns the numbers in ascending order, removing the repeated ones. The script worked from the first compilation, but n...
asked by 29.06.2018 / 18:30
1
answer

Error in def function

How can I calculate salary value with number of hours above 40 as defined in if, I try to run with 41 hours but give me this error salario = float(40*valor_hora+(h_excd*(1.5*valor_hora)))#valor salario com horas extras TypeError: can't multip...
asked by 20.06.2018 / 13:09
1
answer

How to turn all items in a list of strings into integers?

I have a list that contains "n" elements of type str . However, I need to get these elements to be integers. How can I do this? For example, I have this list here: trechos = conteudo[2:len(conteudo)] It turns out that I can not jus...
asked by 30.11.2017 / 21:01
1
answer

Name Display on Diagonal (Top to Bottom)

I have to read a name and display it diagonally, ie from top to bottom. But I am not able to develop the correct logic, I have come to this: nome = input('Digite o seu nome: ') tamanho = len(nome) for nome in range(tamanho): print(nome...
asked by 17.12.2018 / 01:36
2
answers

How to ensure that three conditions are met? Is there a better way to do it? [closed]

A program that asks a person's age, weight, and height and decides if they are fit to enter the army. To enter, you must be of age, weigh more than or equal 60 pounds and measure more or equal 1.70 meters. print('='*5, 'Aliste-se no Exército B...
asked by 19.12.2018 / 02:14