I did so:
import numpy as np
#soma de todas as colunas de mat!
mat = np.arange(1,26).reshape(5,5)
print(mat)
lista =[]
for i in np.arange(0,len(mat)):
lista.append(np.sum(mat[0:,i:i+1]))
print(np.array(lista))
The output is correct:...
Because pygame does not have a library-like function SFML - > View , I'm developing a "camera" format to scroll the screen and preserve the positions of the objects within the general coordinate within the "world".
As default for...
I just need to send a command from one process to another, but I wanted to understand why when modifying the variable within a function, it does not appear in another function.
from multiprocessing import Process
import time
ComandoSerial =...
What is the function of the name of the classes inserted inside the parentheses of the constructor __init__( ) , in classes Telefones , TiposTelefone and Agenda ?
This is just a code snippet from Chapter 10 of "Int...
I have a Dataframe where I'm making the difference between two different dates to get the difference in Hours and Minutes, for example:
data_inicial = '2018-07-03 16:03:00'
data_final = '2018-07-05 00:00:00'
duracao = data_final - da...
I'm having a hard time doing an exercise in the book 'Intensive python course by Eric Matthes' the exercises is as follows:
8.10 - Great Magicians: Eat with a copy of your exercise program 8.9. Write a function called make_great () that modif...
Generating function:
def geraQuadrados(n):
for i in range(n):
yield i**2
for i in geraQuadrados(5):
print(i)
No generating function:
def novosQuadrados(n):
l = []
for i in range(n):
l.app...
I would like to create a function def for the first input and then return it on the third line.
Example:
def se():
sex = input('Digite seu sexo:')
while sex != 'M' and sex != 'F':
#não sei como se retorna esta parte:...
In creating a class I can set some default values:
class Point:
def __init__(self, x, y, z=0):
self.x = x
self.y = y
self.z = z
How to proceed in the same way for namedtuple?
from collection import namedtuple
P...
I wonder if it's possible to add more than one element to a list, for example:
a=[]
a.append('abóbora', 'banana', 'maçã')
or you will need to use three lines, for example:
a=[]
a.append('abóbora')
a.append('banana')
a.append('maçã')
Pl...