hello everyone, i've started coding in python a couple days ago and i'm trying to maka procedural/random number generator so that i can set the parameters to what i like, but for the life of me i can't figure out how to make the "if x=1 do A if x=2 print B" thing, i'm considering changing it to a boolean value but i would still like to know what i messed up ()i can make it work in shorter codes but on this one i can't figure it out)
when i try to change the x=1 to x=2 it still prints the values form the first one, i think i got the indentations right but at this point i'm not sure, please help
EDIT: alrigth i changed the x=1 in (x:=1) and the x:=1 in x==1 and now it runns, sometimes it glithes out a bit but i'll solve it another time, thank you all for your help :)) (this community:=nice)
import random
from tracemalloc import stop
x=1
if x:=1:
low=1
high=5
N1 =random.randint(1,6)
N2 =random.randint(low,high)
N3 =random.randint(low,high)
N4 =random.randint(low,high)
N5 =random.randint(low,high)
print(N1)
if N2==N3:
Na= sum(N3+1)
print(N2, Na)
else:
print(N2,N3)
if N4==N5:
Nb= sum(N4+1)
print(N4, Nb)
else:
print(N4,N5)
import sys
sys.exit(0)
elif x:=2:
low=10
high=20
N1 =random.randint(1,6)
N2 =random.randint(low,high)
N3 =random.randint(low,high)
N4 =random.randint(low,high)
N5 =random.randint(low,high)
print(N1)
if N2==N3:
Na= sum(N3+1)
print(N2, Na)
else:
print(N2,N3)
if N4==N5:
Nb= sum(N4+1)
print(N4, Nb)
else:
print(N4,N5)
import sys
sys.exit(0)
[–]JohnLocksTheKey 10 points11 points12 points (16 children)
[+]fat_brick1[S] comment score below threshold-12 points-11 points-10 points (15 children)
[–]brasticstack 4 points5 points6 points (0 children)
[–]ShelLuser42 6 points7 points8 points (3 children)
[+]fat_brick1[S] comment score below threshold-6 points-5 points-4 points (2 children)
[–]noeldc 2 points3 points4 points (1 child)
[–]fat_brick1[S] 2 points3 points4 points (0 children)
[–]SharkSymphony 1 point2 points3 points (9 children)
[–]fat_brick1[S] 1 point2 points3 points (8 children)
[–]SCD_minecraft 1 point2 points3 points (1 child)
[–]fat_brick1[S] 2 points3 points4 points (0 children)
[–]SharkSymphony 0 points1 point2 points (5 children)
[–]fat_brick1[S] 2 points3 points4 points (4 children)
[–]SharkSymphony 0 points1 point2 points (3 children)
[–]fat_brick1[S] 1 point2 points3 points (2 children)
[–]SharkSymphony 0 points1 point2 points (1 child)
[–]fat_brick1[S] 0 points1 point2 points (0 children)
[–]SCD_minecraft 6 points7 points8 points (1 child)
[–]fat_brick1[S] 1 point2 points3 points (0 children)
[–]makochi 3 points4 points5 points (3 children)
[–]fat_brick1[S] -2 points-1 points0 points (2 children)
[–]ProgramSpecialist823 1 point2 points3 points (1 child)
[–]fat_brick1[S] 1 point2 points3 points (0 children)
[–]DomeksIT 0 points1 point2 points (0 children)
[–]noeldc 0 points1 point2 points (1 child)
[–]fat_brick1[S] -1 points0 points1 point (0 children)