From fa1d1dc4c715b90f8f7f418bfa5d23145c047d39 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Thu, 7 Sep 2017 22:41:08 +0200 Subject: [PATCH] Add files via upload --- ENSIM/Functions.py | 17 +++++++++++++++++ ENSIM/HelloWorld.py | 3 +++ ENSIM/Premiers.py | 20 ++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 ENSIM/Functions.py create mode 100644 ENSIM/HelloWorld.py create mode 100644 ENSIM/Premiers.py 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]