I am new to programming and I tried some of the easy leet code problems. When I run the code on my own it returns the correct boolean value but when I run in leetcode it returns the opposite. Like it returns True in vs code while it returns false in Leetcode. It is a simple program to check if it is a perfect number or not.
class Solution:
def checkPerfectNumber(self, num: int) -> bool:
num = int(input("Enter number: "))
sum = 0
for i in range(1,num):
if num % i == 0:
sum = sum + i
if sum == num:
return True
else:
return False