Advertisement
Guest User

Problem

a guest
May 13th, 2021
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. import random as r
  2. import Mathe as m
  3. from threading import Timer
  4.  
  5.  
  6. def Zuspät(RichtigeZahl) :
  7. print('Zu langsam! Das Richtige Ergebnis ist:', RichtigeZahl)
  8. ***
  9. def Anfang() :
  10. global Zahl3, Zahl4, Punkte
  11. Punkte = 0
  12. if Punkte == 0 :
  13. print("Wie viele Klassen hast Du absolviert? ", end='')
  14. Zahl4 = int(input())
  15. Zahl4 += 1
  16. if Zahl4 == 1 :
  17. Zahl3 = r.randint(1,2)
  18. elif Zahl4 > 1 and Zahl4 <= 5 :
  19. Zahl3 = r.randint(1,5)
  20. elif Zahl4 > 5 and Zahl4 <= 8 :
  21. Zahl3 = r.randint(2,5)
  22. elif Zahl4 > 8 :
  23. Zahl3 = r.randint(3,7)
  24.  
  25.  
  26. def Ende() :
  27. global Zahl3, Zahl4, Ergebniss1, Punkte
  28. print('Erechne diese Aufgabe:')
  29. if Zahl3 == 1 :
  30. Zahl1 = r.randint(10,100)
  31. Zahl2 = r.randint(10,100)
  32. if Zahl4 >= 3 :
  33. print(' '+str(Zahl1), '+' + str(Zahl2) + ' = ', sep='\n', end='\n ')
  34. else :
  35. Zahl1 = r.randint(5,50)
  36. Zahl2 = r.randint(5,50)
  37. print(Zahl1, '+', Zahl2, '=', end=' ')
  38. Ergebnis1 = (Zahl1 + Zahl2)
  39. if Zahl3 == 2 :
  40. Zahl1 = r.randint(11,100)
  41. Zahl2 = r.randint(10,Zahl1-1)
  42. if Zahl4 >= 3 :
  43. print(' '+str(Zahl1), '-' + str(Zahl2) + ' = ', sep='\n', end='\n ')
  44. else :
  45. Zahl1 = r.randint(6,50)
  46. Zahl2 = r.randint(5,Zahl1-1)
  47. print(Zahl1, '-', Zahl2, '=', end=' ')
  48. Ergebnis1 = (Zahl1 - Zahl2)
  49. if Zahl3 == 3 :
  50. Zahl1 = r.randint(4,100)
  51. Zahl2 = r.randint(2,10)
  52. if Zahl4 >= 6 :
  53. while True :
  54. Zahl1 = r.randint(101,1000)
  55. Zahl2 = r.randint(10,100)
  56. if str(Zahl2)[-1] == '0' :
  57. break
  58. Ergebnis1 = (Zahl1 // Zahl2)
  59. Zahl1 = Ergebnis1 * Zahl2
  60. print(str(Zahl1) + ' : ' + str(Zahl2), end='= ')
  61.  
  62. if Zahl3 == 4 :
  63. Zahl1 = r.randint(2,10)
  64. Zahl2 = r.randint(2,10)
  65. if Zahl4 >= 4 :
  66. if Zahl4 >= 6 :
  67. Zahl1 = r.randrange(50,1001, 10)
  68. Zahl2 = r.randrange(50,1001, 10)
  69. else :
  70. Zahl1 = r.randrange(10,101, 3)
  71. Zahl2 = r.randrange(10,101, 3)
  72. print(str(Zahl1) + ' * ' + str(Zahl2), end='= ')
  73.  
  74.  
  75. Ergebnis1 = (Zahl1 * Zahl2)
  76.  
  77. if Zahl3 == 5 :
  78. Zahl1 = r.randint(1,10)
  79. Zahl2 = r.randint(1,7)
  80. print(Zahl1, 'Hoch', Zahl2, end='= ')
  81. Ergebnis1 = (Zahl1 ** Zahl2)
  82.  
  83. if Zahl3 == 6 :
  84. Ergebnis1 = r.randint
  85. (2,15)
  86. Zahl = Ergebnis1**2
  87. print('Wurzel', int(Zahl), end='= ')
  88.  
  89. if Zahl3 == 7 :
  90. Zahl = r.randint(3,8)
  91. print(str(Zahl)+'!', ' = ', sep='', end=' ')
  92. Ergebnis1 = (int(m.Fakultät(Zahl)))
  93.  
  94. Timerin = Zahl4*Zahl3
  95. if Timerin < 5 :
  96. Timerin = 5
  97.  
  98. if Timerin > 20 :
  99. Timerin = 20
  100.  
  101. a = Timer(Timerin, Zuspät, (Ergebnis1, ))
  102. a.start()
  103. Ergebnis2 = int(input())
  104. a.cancel()
  105.  
  106. if Ergebnis1 == Ergebnis2 :
  107. print('Richtig!!')
  108. Punkte += 1
  109. if Ergebnis1 != Ergebnis2 :
  110. print('Leider Falsch. Dass Richtige Ergebnis Lautet :' + str(Ergebnis1))
  111. Punkte -= 1
  112.  
  113. #qwertz
  114. Anzahl = True
  115. Anfang()
  116. while Anzahl :
  117. if Zahl4 == 1 :
  118. Zahl3 = r.randint(1,2)
  119. elif Zahl4 > 1 and Zahl4 <= 5 :
  120. Zahl3 = r.randint(1,4)
  121. elif Zahl4 > 5 and Zahl4 <= 8 :
  122. Zahl3 = r.randint(2,5)
  123. elif Zahl4 > 8 :
  124. Zahl3 = r.randint(3,7)
  125. Ende()
  126. print('Wiederholen oder beenden? (Wiederholen = 1 und beenden = 0) ', end='')
  127. while True :
  128. Antwort = input()
  129. if Antwort == '1' :
  130. print('Ok')
  131. break
  132. elif Antwort == '0' :
  133. print(f'Ok. Du hast {str(Punkte)} Punkte')
  134. Anzahl = False
  135. break
  136. else :
  137. print('Ich Verstehe dich leider nicht, Könntes du es Bitte Nochmal Vers\
  138. uchen? ', end='')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement