Question #257170

Write an if/else statement that compares sold_yesterday and sold_today, and based upon that comparison assigns sales_trend the value -1 (the case where sold_yesterday is greater thansold_today) or 1.


Expert's answer

if __name__=='__main__':
  sold_yesterday = int(input('sold yesterday: '))
  sold_today = int(input('sold today: '))
  sales_trend = -1 if sold_yesterday > sold_today else 1
  print(sales_trend)
LATEST TUTORIALS
APPROVED BY CLIENTS