I see. You didn't declare a function, it's just a python script. So you don't 
need a return in that situation, the script just ends when there are no more 
lines.

By the way: you certainly don't want to return or quit BEFORE you print(nice).  
 But the fix here is simply to delete "return coun".  Then your script will run.

--- Joseph S.

-----Original Message-----
From: Shivlal Sharma <sshivlal9...@gmail.com> 
Sent: Monday, September 7, 2020 3:09 AM
To: python-list@python.org
Subject: What this error want to say? Can't we use return without function?

N = int(input("enter a positive integer:")) coun = 1 while (N > 0):
    coun = coun * N
    N = N - 1
return coun
nice = ntime(N)
print(nice)


error: return outside of the function

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to