I come from PHP. In it, when we want to define a property of a class as private we add the keyword private in its declaration.
Example:
class StackOverflow extends StackExchange
{
private $language = 'en'; // privado, só pode ser...
I'm running some experiments with prime numbers and needed to process huge integers, however when trying to process a small routine an error occurs in the following line:
OverflowError: int too large to convert to float
How can I...
How can I change the value of a variable through a function? Here's an example of what you'd like to do:
def func(t):
t = 2 + 3
t = 7
func(t)
print(t)
The output of the print (t) function returns me the value 7 and not 5 as the desired...
I have a problem where the list I am working on is being modified even though there is no passing of values to it.
from random import *
from numpy import *
m=2
lista_inicial=[[1, 2], [0, 2], [0, 1]]
lista_aux = []
lista_aux = lista_inic...
If I have a x list that contains multiple values, and a few repeats, and I want to have the index for each element, how can I do it? I tried doing it using the .index() method but it only returns the index of the first element.
&...
In PHP, to get the ip of a given domain, I usually use the gethostbyname function.
PHP example:
gethostbyname('www.google.com'); //201.17.165.210
What about Python? How can I do this?
I'm doing a hangman game in Python. Every loop the program asks the letter or the word:
#Jogo
perguntarNovamente = True
game_on = True
while game_on:
palavra_secreta = palavra()
senha_list = [l for l in palavra_secreta]
chances =...
I have the following list:
l = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
What I need is to split this list into n sublists, in this case you can not do it manually since n is going to be dynamic.
I have the following dictionary:
tests_dict = {'test 1': ['Manuel', 'Mariana', 'Filipa'], 'test 2': ['Manuel', 'Filipa', 'Mariana'], 'test 3': ['Mariana', 'Manuel', 'Filipa']}
What I need is that the keys of the new dictionary are the names...