'Keep receiving "TypeError: unsupported operand type(s) for *: 'function' and "float' . I know its probably a simple mistake but I cant find it

Keep getting the TypeError of an unsupported operand. I believe it to be when calling the active_met_rate but I'm not sure what needs to be corrected.

def bmr_calc():
  weightKg = int(input("Weight: "))
  heightInc = int(input("Height: "))
  age = int(input("Age: "))
  gender = input("Are you a (m)ale or (f)emale:").lower()

  if gender == "m":
    base_met_rate = int((66.47 + (6.24*weightKg) + (12.7*heightInc) - (6.76*age)))
  elif gender == "f":
    base_met_rate = int(((4.54*weightKg) + (15.88*heightInc) - (5*age) - 161))
  print("Your Basal Metabolic Rate is " + str(bas_met_rate) + " kcals")
  return base_met_rate

def amr_calc(base_met_rate):
  frequency = int(input("How many days do you work out?: "))
  if frequency == 0:
    act_fact = 1.2
  elif frequency == 1:
    act_fact = 1.2875
  elif frequency == 2:
    act_fact = 1.375
  elif frequency == 3:
    act_fact =1.41875
  elif frequency == 4:
    act_fact = 1.4625
  elif frequency == 5:
    act_fact = 1.55
  elif frequency == 6:
    act_fact = 1.6375
  elif frequency == 7:
    act_fact = 1.725
  active_met_rate = int(base_met_rate*act_fact)
  print("Your Active Metabolic Rate is " + str(active_met_rate) + " kcals")
  return(active_met_rate)

base_met_rate = bmr_calc
active_met_rate = amr_calc(base_met_rate)


Solution 1:[1]

bmr_calc is a function that returns the Base Metabolic Rate. You need to call it, like this: base_met_rate = bmr_calc(). When you do that, then you can pass base_met_rate, which is a float, to amr_calc.

Solution 2:[2]

The simplest approach for installing pandas is to install it as part of the Anaconda distribution

conda create - n name_of_my_env
source activate name_of_my_env
activate name_of_my_env
conda install pandas
conda install pandas = 0.20 .3

As seen here

Solution 3:[3]

You need to install numpy first in your environment, this worked for me:

python3 -m pip install virtualenv
virtualenv -p python3.8 venv
source venv/bin/activate
pip install --upgrade pip
pip install numpy cython
git clone https://github.com/pandas-dev/pandas.git
cd pandas
python3 setup.py install

As seen here: how to install pandas on m1 Mac

Solution 4:[4]

How did you install pandas? As I also have M1 Macbook, it is no matter.

Maybe you can check if directory which you installed pandas is in sys.path directories.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 2pichar
Solution 2 Kofi
Solution 3 newbie
Solution 4 cjlee