Questions tagged as 'python'

1
answer

Why does not the following code work?

The code should receive a number of student grades, print the grades average, and how many grades are 10% below and 10% above average. The code looks like this: quantidade = int(raw_input()) inicio = 0 ListaDeNotas = list() while quantidade &g...
asked by 10.04.2016 / 16:28
3
answers

I can not solve this error in Python, I am a beginner

Well I need to do this multiplication but give the following error: Traceback (most recent call last): File "C:\Users\Guilherme\Desktop\dasdsa.py", line 17, in <module> conta = (trans1) * trans2 TypeError: can't multiply sequence b...
asked by 19.10.2015 / 22:38
1
answer

Paste element using json python

I am using the following code to try to get what is written inside definition , located in list import requests import json word = "salut" page = requests.get("http://api.urbandictionary.com/v0/define?term=" + word) gotcha = page....
asked by 10.01.2018 / 22:36
3
answers

How to test if a host's port is open?

How do I find out if a particular port on a network computer is open? The more efficient the method, the better. I'll need to scan an entire subnet several times a day.     
asked by 23.09.2016 / 00:51
1
answer

ImportError: can not import name certs

I'm running some exercises that I find on the internet. One of them is to use module requests I installed the module in / site-packages, but when I try to import it, shell returns me the following message: >>> impor...
asked by 28.04.2014 / 20:05
2
answers

Python code error [closed]

I have a MAC and everything worked perfectly, I decided to install anaconda to see if it would help me in something and now I do not push my code anymore, I get the following error message:    File   "/Users/claytonpereira/anaconda/lib...
asked by 24.09.2015 / 06:56
2
answers

recursive function with lists

I need to write a recursive function that receives 2 lists and returns a new list with the subtraction of the elements of the first ones, for example: >>> subtrai([2, 3, 4, 5], [2, 3]) [4, 5] I know that I need to know if an elem...
asked by 23.12.2018 / 19:54
1
answer

Open set of texts in python to apply functions (len, set, colocations, etc.). UnicodeDecodeError

>>> import nltk >>> from nltk.corpus import PlaintextCorpusReader >>> meucorpus='C:\Users\dudu\Desktop\Artigos sem acentos' >>> meustextos=PlaintextCorpusReader(meucorpus,'.*') >>> meustexto...
asked by 09.08.2015 / 04:40
0
answers

How to create include a Checkbox in a Datatable table in Django

Hello! I'm with a Boolean field in the table but I did not find in my search anything that would help me change the Boolean by a Checkbox. How do I do that? Follow my Model.py class TelefoneCredor(models.Model): telefone = models.BigInte...
asked by 05.01.2019 / 17:55
1
answer

Function with loop repetition in python

Hello, I am trying to use a function to get the complete list of containers regardless of status, "docker ps -a". When I use the code outside the function, it works. ButwhenIusethesamecodeinsidethefunction,itonlyreturnsmethefirstelementinthe...
asked by 02.11.2018 / 05:11