Recent Changes - Search:

Oktatás

* Programozás 2
  + feladatsor
  + C feladatsor
  + Python feladatsor
  + GitHub oldal

* Szkriptnyelvek
  + feladatsor
  + quick link

* levelezősök
  + Adator. prog.
  + feladatsor
  + quick link

teaching assets


Félévek

* 2024/25/1
* archívum


Linkek

* kalendárium
   - munkaszüneti napok '20
* tételsorok
* jegyzetek
* szakdolgozat / PhD
* ösztöndíjak
* certificates
* C lang.
* C++
* C#
* Clojure
* D lang.
* Java
* Nim
* Scala


[ edit | logout ]
[ sandbox | passwd ]

20121110a

Modules

Write two programs:

  • Print prime numbers that are less than 100 (ex1.py)
  • Print the sum of prime numbers that are less than 200 (ex2.py)

In order to decide if a number is prime, you can use this simple function:

def is_prime(n):
    """
    Decide whether a number is prime or not.
    """

    if n < 2:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False

    i = 3
    maxi = n**0.5 + 1
    while i <= maxi:
        if n % i == 0:
            return False
        i += 2

    return True

Further instructions will be given during the lab…


The source code of the Miller-Rabin algorithm is here: miller_rabin.py.

Cloud City

  

Blogjaim, hobbi projektjeim

* The Ubuntu Incident
* Python Adventures
* @GitHub
* heroku
* extra
* haladó Python
* YouTube listák


Debrecen | la France


[ edit ]

Edit - History - Print *** Report - Recent Changes - Search
Page last modified on 2023 April 17, 15:06