# Trying to make a pow() calculator, without the pow, ERROR message "'int' object has no attribute 'count'"

by GeorgeWTrump   Last Updated October 09, 2019 17:26 PM

The idea is, that the calculator is supossed to detect the numbers of num1 in the calculation and add more until it is equal to the num2, as it is supossed to be num1 raised to the power of num2.

But I keep recieving this message "'int' object has no attribute 'count'". I know count is for lists, so I was wondering, what the appropriate command would be for int (or float).

Furtheremore, how would I go about adding the numbers of "num1" to the equation?

Here is the whole code

num1 = int(input("Enter a number"))
operator = input("Now enter an operator")
num2 = int(input("Enter a new number"))
Pow = (num1*num1)

if operator == "^":
print(Pow)
while Pow.count(num1) < num2 += 1:
Pow = num1 * num1
Tags :

You have an Invalid Syntax here which is while Pow.count(num1) < num2 += 1:

Have a look at this edited code:

num1 = int(input("Enter a number"))
operator = input("Now enter an operator")
num2 = int(input("Enter a new number"))
Pow = (num1*num1)
if operator == "^":
print(Pow)
while Pow.count(num1) < num2:
Pow = num1 * num1
num2 += 1
Ahmed Wagdi
October 09, 2019 17:25 PM

## Related Questions

Updated February 24, 2018 05:26 AM

Updated June 20, 2017 14:26 PM

Updated December 17, 2018 14:26 PM

Updated July 28, 2017 22:26 PM

Updated May 07, 2017 08:26 AM