NUMFACT-RUNTIME ERROR in python 3

sir I did the NUMFACT question in python 3.I GOT correct answers but here I’m getting runtime error.PLEASE SEE THIS.THANKS
my code:

t=int(input())
for m in range(1,t+1):
count=0
num=1
subt=int(input(""))
for i in range(1,subt+1):
value=int(input())
num=num*value
for i in range (1,num+1):
if(num%i==0 ):
count=count+1
print(count)

Bro your method to take input is wrong.

If you want to take single line multiple value input you cannot use for loop, you must use map().

For example:

3
3
3 5 7
3
2 4 6
2
5 5

In this input if you want to take 3 5 7 you cannot just code

for i in range(1,4):
    a=int(input(""))

This is a wrong call which is leading to error, you have to take input in this manner,

a=map(int,input("").split())

Now as you are multiplying every number in a you can use for loop as

for i in a:
    num=num*i

I have updated your code you may have a look at it here: http://ideone.com/p9ZSeX

Hope you understood…:slight_smile:

You may read about split() here : http://stackoverflow.com/questions/17222355/string-split-formatting-in-python-3

EDIT: Okay i am sorry, there is a problem with this line

a=map(int,input("").split())

In python 3 map returns iterator instead of list so you must replace this line with

a=list(map(int,input().split()))

Sorry for the inconvenience…!!.

THANK YOU VERY MUCH SIR

welcome… :slight_smile: