-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheau02.2.py
51 lines (35 loc) · 955 Bytes
/
eau02.2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import sys
# Récupérer les arguments rentrer par l'utilisateur puis les inverser
'''arguments = sys.argv[1:]
reversed_arguments = arguments[::-1]
if not arguments:
print("Error: Merci de rentrer au moins un argument")
sys.exit()
for words in reversed_arguments:
print(words)'''
'''arguments = sys.argv[1:]
if not arguments:
print("Error: Merci de rentrer au moins un argument")
sys.exit()
#arguments.reverse()
reversed_arguments = list(reversed(arguments))
print(reversed_arguments)
for words in reversed_arguments:
print(words)'''
import sys
arguments = sys.argv[1:]
if len(arguments) != 2:
print("erreur.")
sys.exit()
dividend = int(arguments[0])
divisor = int(arguments[1])
if divisor == 0:
print("erreur.")
sys.exit()
if dividend < divisor:
print("erreur.")
sys.exit()
rest = (dividend % divisor)
result = (dividend / divisor)
print(f"résultat: {int(result)}")
print(f"reste: {rest}")