range creates a list in memory with the number of elements defined by the programmer. Since xrange has more performance, I do not know if in all cases, since it does not end up generating a list.
Should I always use xrange...
Is there any native Python way to round up?
Example: 10/3 resulting in 4 .
What I'm using now is a conditional:
x=10
if x % 3 != 0:
x += 1
But that's not very practical.
I need to perform a query in a txt file in Python, however I have 2 problems due to the interpretation of special characters.
When I enter | or \ the result ends up being replaced: | is interrupted as white space and \...
Hello everyone, how are you?
I'm doing an activity for my python course, it's a script that basically calculates the area of a wall in meters and tells how many gallons will be used for paint.
The problem is that when I type a very high value...
I'm a beginner in Python and I'm trying to create an alarm clock ... But it does not "Wake up" on time, can anyone help me?
import datetime
import time
print("Digite a hora para ligar (HH:MM)")
t_desp = str(input(""))
t_desp += ":00"
print("D...
I tried to create a square root function:
def root(n, ind):
if ind == None:
ind = 2
ind2 = 1 / ind
print(n ** ind2)
I want ind not to be mandatory.
I thought that if I did not put it, the value would become...