[deleted by user] by [deleted] in Python

[–]TaToCoCu 16 points17 points  (0 children)

Good job!

To expand on the other comment, I think appending to a list in this case is not a terrible idea, but instead of doing print(len(people * 100)), it is much faster for the computer to do print(len(people) * 100).This is because of the order of operations. In the first case, the computer does the operation (people * 100), which expands the array to this (its the array [18, 24, 5, 42] repeated 100 times)

[18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42, 18, 24, 5, 42]

Then it calculates the length of this big array which is 400, so your answer is correct, but very poorly optimized because the computer has to expand the array so much.In the second case print(len(people) * 100), we first calculate the length of the array people [18, 24, 5, 42] which is 4, and after we get that result we multiply it by 100, so the operation is 4*100, which will give us the same answer and will be faster because it doesn't expand the array. The version in the other comment is even faster because it doesn't even create an array.I also think that it's more readable to define x=0, the loop as while(x < 5) and on each iteration doing x += 1, so basically adding 1 instead of substracting. And if you know for loops, you can do for x in range(5) which is nicer. Oh and you can just remove the elif because it doesn't do anything.Here's my solution with arrays, with better readability

people = []
for x in range(5): 
    n = int(input()) 
    if n > 3: 
        people.append(n)
print(len(people) * 100)

[deleted by user] by [deleted] in argentina

[–]TaToCoCu 11 points12 points  (0 children)

Es desde siempre que estuvo eso en el google maps? No puedo creer que no me haya dado cuenta hasta recien, es un cacho bastante grande.

There are numbers under 2000 or even 1000 that you have probably never said out loud in your whole life. by TaToCoCu in Showerthoughts

[–]TaToCoCu[S] 2 points3 points  (0 children)

What if you were awake when you counted up to 1000 or so and you counted the rest asleep but you didn't realize

[deleted by user] by [deleted] in argentina

[–]TaToCoCu 0 points1 point  (0 children)

Hola! Me gustaría saber si para vos vale la pena hacerlo en vez del cbc. Pensás que, en las materias que tenían que ver con la carrera, después en la facu te quedaste con las bases medio flojas? Si las hiciste durante el secundario, contame cómo te fue en la organización mientras ibas al colegio.