0

I was trying to make a data set calculator, but when I tried to do the median, the elif was not working. I tried to put in "median", but it kept going with the "mean" choice.

dataSet = []
calculateType= ""
def makeDataSet():
  print()
  newNum = input("Insert data set item here: ")
  print()
  dataSet.append(int(newNum))
  newNum = 0
  end = input("Was that the last item? ")
  if end == "no" or "No":
    makeDataSet()
calculateType = input("What would you like to calculate? ")
if calculateType == "mean" or "Mean":
  pass
elif calculateType == "median" or "Median":
  makeDataSet()
  print("finally")

The process went like this

What would you like to calculate? Median And then the program would end because of the pass statement in the "Mean" statement. I even looked up the value of the variable calculateType and it even said "Median". It is only executing the code in the "Mean" if statement. Can somebody please tell me what is going on?

Note: I have some experience with coding, but this is my first python program

0 Answers0