Questions tagged as 'python-3.x'

1
answer

How do I intersect each position in my list?

I have tried the following ways based on the answers obtained here in the forum. First form: A = [[1,2,3,4,5,6,7,8,9,10],[1,3,5,7,8,9,10,20],[4,5,7,13,16,20,21,30]] B = [1,2,3,4,5,6,7,8,9] C = [10,11,12,13,14,15,16,17,18,19] D = [20,21,22,2...
asked by 18.08.2018 / 08:47
2
answers

How to concatenate items from a list in python?

Let's say I have the result of a list: ['_', '_', '_', '_', '_', '_', '_'] How can I turn it into this?: ['_ _ _ _ _ _ _'] Or even in a variable with the value above     
asked by 26.08.2018 / 00:08
3
answers

How not to return a None value in python

I have the following sample code lista = [100,200,1000,3000,2,3,4,5,6,7,8] def regras(x): if x < 100: if x % 2 == 0: return x if x >= 100: return (x+x) v1 = list(map(regras,lista)) print(v1) that...
asked by 11.08.2018 / 19:19
1
answer

Why does not font change in Raspberry Pi?

I have a graphical application using Gtk in Python, the program has font definitions and font sizes. When running the program in linux works correctly, but when running on Raspberry the font is not changed. Does anyone know why this happens?...
asked by 06.02.2018 / 19:28
1
answer

Algorithm to determine the prime numbers between 2 and N. What is wrong?

n = int(input("Digite N: ")) lista =[] divisores =[] for i in range(2, n+1): for j in range(1,n+1): if i>=j: if i%j ==0: divisores.append(j) print("divisores",divisores) if...
asked by 23.03.2018 / 01:35
1
answer

How to improve a bar graph whose values are very close in Python?

I'm drawing the bar graph using the following Python code: # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib.dates as dates from datetime import datetime, timedelta x = [] y = [] with open("Tem...
asked by 14.09.2017 / 15:52
1
answer

How to manipulate strings with ".find"

Can I use ".find" to make the program search for a word within a typed text and say whether it exists or not (true or false) and in which line of text it is located, if not, which command use to do this? What I already have: a = str(input()) #...
asked by 25.10.2017 / 19:39
1
answer

How to display multiline text with format?

I'm trying for several consecutive lines with a single string along with the .format method, but I can not. a=input("digite algo; ") print("""contem maiusculos:{} contem: {}n\contem números: {} contem alfanumericos: {}""".format(a.i...
asked by 30.10.2017 / 18:46
2
answers

Recursive function with strings - Python

I can not solve an exercise. The statement is as follows: Implement the uncomfortable (n) function that returns a string containing "bother" (the word followed by a space) n times. If n is not a strictly positive integer, the function should ret...
asked by 28.05.2017 / 03:12
1
answer

Python administrator privileges [closed]

Is there any way or command to run a Python script with admin privileges?     
asked by 02.01.2017 / 18:19