I started shortly in the Python language and am currently working on a project using Flask , MariaDB and WebSockets .
I see people talk a lot about Django and would like to know the differences between two.
In Python it's common to read that ast.literal_eval is an alternative to eval .
Are the functions equivalent? What does one do to another also?
In security issues, is there priority in using one or the other?
What are th...
I have a list of tuples of the form:
[(0, 1), (2, 3), (4, -5), (6, -3)]
I want to sort this list by the second value of each tuple (that is, in case we would have [(4, -5), (6, -3), (0, 1), (2, 3)] . How to do that?
Suppose the following:
import numpy as np
a = np.array ( [1.1, 2.2, 3.3] )
How to convert this array to int without having to iterate each element or using another array?
Why to:
b = int(a)
It gives an error because it is on...
From the book I'm studying, at times the author uses __init__ as being a first function of a class. This function (and others) always have self as one of the variables (something that I still do not understand why). When should (an...
I created the following serial code to perform the Odd-even sort ordering, which first sorts the odd / even and odd / even indices.
import time
def oddevenSort(x):
sorted = False
while not sorted:
sorted = True
#orden...
Hello,
I have a problem, more mathematical than computational, to solve, but I have not been able to solve it myself until now ...
I have a set of 3 atoms connected to each other forming an angle X between the bond. I need to implement a c...
I'm trying to make a program, in Python, that returns a list with elements not common between two other lists. I made the following code:
def indice(a,b):
ind = []
for i in range (len(a)):
for w in range (len(b)):
i...