Questions tagged as 'python'

3
answers

if and logical connectives

I need to find the least number and the second smallest number of five numbers entered. But this strange fact is happening: #Subtrair o menor numero encontrado do numero digitado dif1 = n1 - menor dif2 = n2 - menor dif3 = n3 - menor dif...
asked by 23.05.2018 / 12:09
2
answers

Find the maximum and minimum number in list in a string

I have the following file: a = '1 0 10 2 3' I want to print the highest and lowest values, so I used max() and min() but it only counts the unit. I did this: a='joao 1 0 10 2 3' b=a.split() c=max(b[1:]) print(c) c=min(b[1:])...
asked by 29.11.2018 / 22:17
0
answers

Error Handling Paramiko (Python)

Hello, I am putting together a script where the user will authenticate to an equipment, if everything goes right the code continues or it shows an error message. I am using the Paramiko library to do the session with the equipment, the connec...
asked by 12.07.2016 / 19:16
3
answers

AttributeError: 'QString' object has no attribute 'strip'

I'm doing a small application in Pyqt4 to understand the operation. In a given part, I'm using a callback function to display a QLabel text that is typed in QtextEdit . This text should be trimmed (remove spaces before and after...
asked by 14.10.2016 / 19:28
3
answers

Is there any interfaces in python?

In languages like PHP and Java, there are interfaces , which, when implemented in a class, forces it to contain the methods of this interface, just as they were declared. Example in PHP: <?php interace UserInterface { public fu...
asked by 03.07.2015 / 17:50
4
answers

Recursive and iterative function that calculates the factorial from 1 to n

Good people, I wanted help in a workout: Asks to create a function that calculates the factorial of numbers from 1 to n. I already have the recursive part, but I do not know how to do it to give me from 1 to n. def fatorial(n): if n ==...
asked by 07.01.2016 / 21:09
5
answers

What is the functionality of \ n?

I'm learning to program in Python and some basic things still confuse me, for example this question I asked. How useful is \ n?     
asked by 18.07.2017 / 16:55
3
answers

How does the variable p work in this code?

I do not know how the variable p of the loop while is working on this code. If the variable p is the iteration variable, why does the exercise also use a p variable within while to store s.find( "tigre"...
asked by 05.05.2017 / 21:28
2
answers

Number divided by a divisor greater than it returns zero?

I went to do a calculation in Python 2.7 and I was scared to see the result: val = 1 / 16 print(val); # 0 Example on IDEONE That is, when we make a division where the number divided is less than the divisor, the result returned is ze...
asked by 14.04.2017 / 18:37
3
answers

creating a voting bot in python

import requests dados = {"action": "polls", "view":"process", "poll_id":"2", "poll_2":"6", "poll_2_nonce":"e29cc82a53"} url = "http://soulegal.byethost7.com/wp/wp-admin/admin-ajax.php" requests.post(url, da...
asked by 29.07.2016 / 05:12