diff --git a/ENSIM/Functions.py b/ENSIM/Functions.py new file mode 100644 index 0000000..85af2a0 --- /dev/null +++ b/ENSIM/Functions.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +n = 0 + +def setup(): + global n + n = 100 + +def loop(): + global n + n = n + 1 + if((n % 2) == 0): + print(n) + +setup() +while True: + loop() diff --git a/ENSIM/HelloWorld.py b/ENSIM/HelloWorld.py new file mode 100644 index 0000000..619f94a --- /dev/null +++ b/ENSIM/HelloWorld.py @@ -0,0 +1,3 @@ +#!/usr/bin/python + +print "Hello, world !"; diff --git a/ENSIM/Premiers.py b/ENSIM/Premiers.py new file mode 100644 index 0000000..695be5d --- /dev/null +++ b/ENSIM/Premiers.py @@ -0,0 +1,20 @@ +#!/usr/bin/python +import math #Importer le module math pour la racine carree + +#value = input("Jusqu'a quel nombre voulez-vous chercher un nombre premier ?") + +value = 100000 + +tab = range(0, value) + +for i in range(2, int(math.ceil(math.sqrt(value)))): + if tab[i] != -1: + for j in range(i+1, value): + if tab[j] > 1: + #print tab[i] % tab[j] + if tab[j] % tab[i] == 0: + tab[j] = -1 + +for i in range(0, value): + if tab[i] != -1: + print tab[i]