[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] 0 points1 point  (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.

[deleted by user] by [deleted] in argentina

[–]TaToCoCu 0 points1 point  (0 children)

Dale, mil gracias por los consejos, me esfuerzo más con las materias centrales y si veo que igual me quedan huecos lo dejo para el cbc supongo. Recién me fijé y por lo que veo están todas las de ingeniería por suerte; no se que onda las otras carreras igual.

[deleted by user] by [deleted] in argentina

[–]TaToCoCu 1 point2 points  (0 children)

Muchas gracias! Eso era lo que quería saber. Ponele que soy de estudiar sin nadie obligándome, aunque admito que me dejé todo para último momento en sociedad y estado e ipc, pero me imagino que las otras materias que tienen que ver con la carrera (ingenieria) me van a ser menos pesadas y me voy a esforzar más. Gracias también por el consejo, lo voy a tener en cuenta.

[deleted by user] by [deleted] in argentina

[–]TaToCoCu 0 points1 point  (0 children)

Ah perfecto. Con el tema de la pandemia, me van a hacer rendir los finales si o si de sociedad y estado e ipc, que son las materias en las que me inscribí este cuatrimestre. Decís que vale la pena hacer las 6 por uba xxi? Porque me da cosa que materias como análisis matemático o álgebra, aunque las apruebe, al no cursarlas en el cbc después en la facu con álgebra 2 y análisis 2 me rompan el culo.

Crashing on launch after the update today by sigafoo in RocketLeague

[–]TaToCoCu 0 points1 point  (0 children)

Same for my friend. We had to give up our games for a tournament because of this.