x_count = int(input("Kac tane x kullanilacak? "))
y_count = int(input("Kac tane y kullanilacak? "))
xs = list(range(x_count + 1))
ys = list(range(y_count + 1))
print("x=", xs)
print("y=", ys)
mode = 'start'
rstr = ""
while True:
if mode == 'start' or mode == 'operand' or mode == 'assign':
ops = input("Operand? ")
if ops == 'x':
op = xs
rs = "x"
if ops == 'y':
op = ys
rs = "y"
if ops == 'bit':
break
opi = int(input("Index? "))
rs += "[" + str(opi) + "]"
opval = op[opi]
if mode == 'start':
val = opval
else:
val = opf(val, opval)
if mode == 'assign':
op[opi] = val
rstr += " -> " + rs
print(rstr)
print("x=", xs)
print("y=", ys)
rstr = ""
mode = 'start'
else:
rstr += rs
mode = 'operator'
elif mode == 'operator':
ops = input("Operator? ")
if ops == '&&':
opf = lambda x, y: (x and y)
rstr += " && "
mode = 'operand'
if ops == '||':
opf = lambda x, y: (x or y)
rstr += " || "
mode = 'operand'
if ops == 'sonuc':
mode = 'assign'
if ops == 'bit':
break
print("x=", xs)
print("y=", ys)
---
Kac tane x kullanilacak? 10
Kac tane y kullanilacak? 10
x= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Operand? x
Index? 0
Operator? &&
Operand? x
Index? 2
Operator? sonuc
Operand? y
Index? 0
x[0] && x[2] -> y[0]
x= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Operand? x
Index? 0
Operator? &&
Operand? x
Index? 4
Operator? ||
Operand? y
Index? 0
Operator? sonuc
Operand? y
Index? 1
x[0] && x[4] || y[0] -> y[1]
x= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Operand? x
Index? 3
Operator? ||
Operand? x
Index? 5
Operator? sonuc
Operand? y
Index? 0
x[3] || x[5] -> y[0]
x= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y= [3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Operand? bit
x= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
y= [3, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]