SHARE
TWEET

Untitled

zeeph Dec 3rd, 2018 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Sujet 2 mode simplifié
  2. scores = [21,12,14,9,4,11,18]
  3. print(scores)
  4.  
  5. scores = sorted(scores, reverse=False)
  6. print(scores)
  7. print('Il y a :',len(scores),'éléments triés')
  8.  
  9. #Sujet 2 mode random
  10. import random
  11.  
  12. scores = []
  13.  
  14. while (len(scores)!=10):
  15.     a = random.randint(0,31)
  16.     if (a) != 30 and [a] not in scores:
  17.         scores.append(a)
  18. scores = sorted(scores, reverse=False)
  19.  
  20. print(set(scores))
  21. print('Il y a :',len(scores),'éléments triés')
  22.  
  23. #Sujet 1
  24. valeurs = []
  25. liste = []
  26. réponse = int(input("Indiquez le nombre de valeurs que vous voulez mettre : "))
  27. c = 0
  28.  
  29. for v in range(réponse):
  30.     liste.append(int(input("Valeur: ".format(v+1))))
  31.  
  32.  
  33.  
  34. for x in range((len(liste)-1)):
  35.     if ((liste[x]+1) != liste[x+1]):
  36.         c = 1
  37.         break
  38.         x+= 1
  39.  
  40. print(liste)
  41.  
  42. if(c == 0) :
  43.     print("La liste est consécutive")
  44. else:
  45.     print("La liste n'est pas consécutive")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top