首页 > 解决方案 > 如果在变量资源管理器中没有打印

问题描述

我正在使用 Spyder IDE。我想计算该值,为此,我使用了 if else 条件。但我看不到变量资源管理器中的计算值。请建议我解决方案。

p = pd.read_excel('Data1.xlsx')
p.head()
a = p.iloc[:12,0].values
b = p.iloc[:12,1].values

c = 200.00
d = 150.00
s = int()
def s(a, b):
       if   a + b < c:
       s = c
       elif a + b > d:
       s = d 
       else:
       s = a + b
return s
print(s)

标签: pythonpython-3.xpandas

解决方案


a=50 #example a
b=100 #example b

c = 200
d = 120
s=int()
def s(a, b):
    if a + b < c:
        s = c
    elif a + b > d:
        s = d 
    else:
        s = a + b

    return s
print(s(a,b))#Use the same arguments as in your def statement

推荐阅读