Posts by user158657 • 105 points
7 posts
- 
		-1 votes1 answer34 viewsQ: Execution time of the codeGood evening, what could I do to know the time of each iteration that my code makes? Searching a little I found the command time.time(), but when the use in my code I get only 0.0 results. Someone… python-3.xasked user158657 105
- 
		2 votes1 answer132 viewsQ: List modification problem within a function (python)def f(i): return i + 2 def g(i): return i > 5 def aplicacao(L, f, g): lista_f = [f(i) for i in L] lista_g = [g(i) for i in lista_f] L = [L[k] for k in range(len(L)) if lista_g[k] == True] if… pythonasked user158657 105
- 
		-1 votes1 answer82 viewsQ: Doubt old game loop (Python)Good afternoon, people. This is a code I saw that plays an old game. Could someone please explain to me how the Loop function evaluate and play_game is working? Specifically that part for player in… pythonasked user158657 105
- 
		3 votes3 answers95 viewsQ: Difference between creating a list with each iteration and using a list comprehensionI need to calculate the distance between the points (0,0) and (1,1). For that, I wrote the following code: def distance(x, y): if len(x) != len(y): return "x and y não possuem o mesmo comprimento"… 
- 
		2 votes3 answers372 viewsQ: Some help in function exercise (python)The exercise speaks the following : "Write a function that takes a positive integer m and returns 1 if m is prime, 0 otherwise." My attempt : Edit: Then , performed the modifications the program is… pythonasked user158657 105
- 
		1 votes1 answer107 viewsQ: Strange return when calling a functionI’m trying to do an exercise on functions, in Python, with the following statement: "Make a program that converts from 24-hour notation to 12-hour notation". Example: Convert 14:25 to 2:25 PM. The… pythonasked user158657 105
- 
		1 votes0 answers51 viewsQ: Syntax Error in the listI was doing the following exercise : "Make a program that reads 4 notes , show the notes and the media on the screen. " My show went like this : lista = [ ] i = 0 soma = 0 while(i < 3): nota =… pythonasked user158657 105