Jump to content

so the homework from ep-14 was not all that clear to me, I think I 'm doing what was asked for i...


 Share

Recommended Posts

so the homework from ep-14 was not all that clear to me, I think I'm doing what was asked for if not this example dose have a read from file, some very basic maths and a prime number function :) 

 

https://github.com/gormuri/c101-python

files:

14-1.txt has the numbers in csv 

ep-14.py is the code that reads from 14-1.txt

https://github.com/gormuri/c101-python

Link to comment
Share on other sites

HI !

 

the import math is actually a python maths library that is built in. you need to import it to get the square root function, what I mean by saying ported, is that I already had that primary number function in php that I wrote some years ago and I just changed the php code into python code using the exact same logic :)

 

https://docs.python.org/2.7/library/math.html

Link to comment
Share on other sites

well 2 weeks ago i was on the IRC channel and you did a good job with Guttormur  before the show but Gutti is probably a lot easier and  usually go by that nick, but if you want to you can just say it as you think it sounds :)

 

on my code I had to make a minor change to the is_prime function as was having some issues with the int() function rounding, it will not give false positives if you use my dataset but with smaller int's it will give you a false positives  :)  it has some thing to do with it rounding down.

 

looking forward to next week's show :D

Link to comment
Share on other sites

 Share

×
×
  • Create New...