Nov-14-2020, 11:51 AM
I have the folowing program and I don't understand why it says hat there is an error on the line n°8.
Could someone help me fix he bug please?
from random import *
a=0
b=0
d=0
n=int(input("Combien de déplacements?"))
for i in range(1,n+1):
d=randint(1,4)
if d=1:
a=a+1
elif d=2:
a=a-1
elif d=3:
b=b+1
elif d=4:
b=b-1
print("L'abscice du point au bout de",n,"déplacements est de",a,)
print("L'ordonée du point au bout de",n,"déplacements est de",b,)
Could someone help me fix he bug please?
from random import *
a=0
b=0
d=0
n=int(input("Combien de déplacements?"))
for i in range(1,n+1):
d=randint(1,4)
if d=1:
a=a+1
elif d=2:
a=a-1
elif d=3:
b=b+1
elif d=4:
b=b-1
print("L'abscice du point au bout de",n,"déplacements est de",a,)
print("L'ordonée du point au bout de",n,"déplacements est de",b,)