2018-04-24

posted Apr 24, 2018, 6:23 AM by Konstantinovich Samuel
If you want to have your profile page entered into the competition fill this out please:
https://goo.gl/forms/1Y8L8nHhXOF0XCJe2


Prime testing.
1. Check if a number is prime.
isPrime(2) is true
isPrime(1) is false
isPrime(9) is false
isPrime(13) is true

2. Generate the nth prime number.
nthPrime(1) is 2
nthPrime(2) is 3
nthPrime(3) is 5
etc.

3. Generate n prime numbers. *this is what we want*
generatePrimes(3) is [2,3,5]



Change A text file into HTML:

Take the alice Chapter 1, open it in python, and print a complete webpage (doctype header etc.)

This should print the book in a nice format. You should use
s = s.replace (old, new)
to change some of the text so that it looks better. (hint: new lines requires this)

Hint: Since windows uses \r\n for newlines, and linux uses \n for newlines files can be fixed with this:
if "\r\n" in text:   
    text = text.replace('\r\n',"\n")
ċ
alice-chapter1.txt
(11k)
Konstantinovich Samuel,
Apr 24, 2018, 6:24 AM
Comments