archivo = open(“carros.txt”, “r”)
lineas = archivo.readlines()
#def primero:
y = 0
contcity = 0
for i in lineas:
x = (i[52:54])
if (x != “”):
x = float(x)
y = y + x
contcity = contcity + 1
city = y//contcity
print(‘The average gas mileage in city is: ‘,city)
p = 0
conthigh = 0
for i in lineas:
z = (i[55:57])
if (z != “”):
z = float(z)
p = p + z
conthigh = conthigh + 1
high = p // conthigh
print(‘The average gas mileage in highway is: ‘,high)
f = 0
contmind = 0
for i in lineas:
a = (i[42:46])
if (a != “”):
a = float(a)
f = f + a
contmind = contmind + 1
mind = y//contmind
print(‘The average mind-range price is: ‘,mind)
#52
]]>Here is my code:
]]>But there are some numbers that havent been able to prove this theory, i even read that ones, scientifics let a computer programm running for three years in search for its palyndrome, eventually they stopped the programm and found a number of one million digits which is a lot, but never the palyndrome.
I get confused a lot with variables but at the end Ken helped me to fix the last problems, here is my code: https://github.com/sabaldaba/TC101/blob/master/wsq11_soy:196
Hope you like it!
]]>It was just taking both numbers and getting its module, then dividing the second number and the module, until the module was 0.
]]>And I found out the function “atoi”(it converts strings to integers) is in the “algorithm” library… so good I had BigInteger when doing the “Yo Soy 196”.
I had to research a lot for this one, and learned how to use the substract stuff (like substr() and c_str() )
Here the page that helped me: http://www.cplusplus.com/
And now all I have to say is thanks to Ken, I enjoyed his flipped course a lot, I learned in a way I have never learned before.
An image:
The code:
Thank you, very single one. See you later.
]]>
The code i wrote is this: https://github.com/sabaldaba/TC101/blob/master/Wsq09-Factorial
The program at the end also gives you the option of doing another operation or to end, this was done thanks to a while loop while the factorial calculator was done with a for loop since in there i knew a specific range.
Hope you like it!
]]>
This was easy a heck, It was just about reading and doing examples.
Now I (kind of) know how to use Scilab, an incredible program that could do almost everything, here some images:
I highly recommend you to use this program. Have a nice week and happy holidays.
See you!
]]>There are only two WSQ’s left, I’m so freaking excited.
The image:
The code: https://github.com/hrglez/TC1017/blob/master/WSQ14%20-%20Euler
Hugs for everyone, good luck, work hard. See you!
]]>This is suppose to be my plan to finish the semester:
A long weekend is coming, and you are going to see me expending my time in a chair in front of my computer and notebooks (they are going to be like my best friends this weekend).
So after this long weekend I should have finished 16 over the 17 WSQ’s (I think I will have some problems with the 16th).
Working on the final project is of course a priority. I will research a lot and ask Ken about this, because I feel pretty lost in this thing.
About another courses, I kind of screwed, but I am going to done this, I’m sure.
Good luck for everyone!
-So good I will pass this course and never look for programs again.
-Dude, you are studying mechatronics, and this was the first semester.
-Shit…
]]>I’m getting closer to the end of this course, fuck yeah!
I do not want to lie, I took the idea from two places:
-This video: https://www.youtube.com/watch?v=sZmz7znP6x0
-This blog: https://modelac.wordpress.com/2007/02/16/ide-uso-en-c-c-raiz-cuadrada-programada-configura-tu-ide/
The image:
The code: https://github.com/hrglez/TC1017/blob/master/WSQ13%20-%20Babylonian%20Square%20Root
Good luck fellows! Have a great day.
]]>