أين الأخ الأخ فتحي و saded و imb و المجموعة الثالثة

10 + 5 * / 2
10 + 5x =
s = raw_input()
string = ""
for c in s:
if (c != ' ' and c != '\n' and c != '\t' and c != '\r'):
string += c
nums = []
operators = []
for c in string:
if (c >= '0' and c <= '9'):
n += c
else:
nums.append(float(n))
n = ""
nums.append(float(n))
for b in string :
if (b == "+" or b == "*" or b =="/" or b == "-" or b == "=" ) :
operators.append(b)
print nums,operators
if "=" in operators:
print "here start equations"
else :
print (string, '=', calc(nums, operators))
if nums==operators :
print "wrong"
def calc() :
s = raw_input()
string = ""
for c in s:
if (c != ' ' and c != '\n' and c != '\t' and c != '\r'):
string += c
n = ""
nums = []
operators = []
for c in string:
if (c >= '0' and c <= '9'):
n += c
else:
nums.append(float(n))
n = ""
nums.append(float(n))
for b in string :
if (b == "+" or b == "*" or b =="/" or b == "-" or b == "=" ) :
operators.append(b)
print nums,operators
if "=" in operators:
print "here start equations"
else :
print (string, '=', calc(nums, operators))
if nums==operators :
calc()
تعليق