<jupyter_start><jupyter_text>Python Basic Programming Assignment_9  1.	Write a Python program to check if the given number is a Disarium Number?<jupyter_code>#Answer:

# program to check if the gien number is a Disarium Number

# Disarium Number: Sum of its digits powered with their respective position is equal to the original number. 
# Some other DISARIUM are 89, 175, 518 etc. 89 == 8**1 + 9**2

def Length(n):    
    length = 0   
    while(n != 0):    
        length = length + 1  
        n = n//10;    
    return length;    
       
     
def isDisarium(num):
    len = Length(num)
    rem = 0
    sum = 0
    n= num

    while(num > 0):
        rem = num%10    
        sum = sum + int(rem**len)    
        num = num//10   
        len = len - 1
    
    
    if(sum==n):
        print(str(n) + " is a disarium number")
        
    else:
        print(str(n) + " is not a disarium number")    
        
isDisarium(89)<jupyter_output>89 is a disarium number<jupyter_text>2.	Write a Python program to print all disarium numbers between 1 to 100?<jupyter_code>#Answer:

# program to print all disarium numbers between 1 to 100

def Length(n):    
    length = 0   
    while(n != 0):    
        length = length + 1  
        n = n//10;    
    return length;    
       
     
def isDisarium(num):
    len = Length(num)
    rem = 0
    sum = 0
    n= num

    while(num > 0):
        rem = num%10    
        sum = sum + int(rem**len)    
        num = num//10   
        len = len - 1
    
    
    if(sum==n):
        return True
    
    else:
        return False

l = []
for i in filter(isdisarium,range(0,101)):
    if True:
        l.append(i)
print("All disarium numbers between 0 and 100 are:",l)<jupyter_output>All disarium numbers between 0 and 100 are: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 89]<jupyter_text>3.	Write a Python program to check if the given number is Happy Number?<jupyter_code>#Answer:

# proram to check if the given number is Happy Number

# In number theory, a happy number is a number which eventually reaches 1 when 
# replaced by the sum of the square of each digit.

# Ex: 7, 49, 97, 130, 10, 1, 


def isHappyNumber(num):    
    rem = sum = 0 
        
    #Calculates the sum of squares of digits    
    while(num > 0):    
        rem = num%10   
        sum = sum + (rem*rem)  
        num = num//10  
    return sum   
        

def happy_num(num):
    result = num
    while(result != 1 and result != 4):
        result = isHappyNumber(result)
        
    if(result == 1):
        print(str(num) + " is a happy number")

        
    elif(result == 4):
        print(str(num) + " is not a happy number")
        
happy_num(82)<jupyter_output>82 is a happy number<jupyter_text>4.	Write a Python program to print all happy numbers between 1 and 100?<jupyter_code>#Answer:

# program to print all happy numbers between 1 and 100

def isHappyNumber(num):    
    rem = sum = 0;    
        
    #Calculates the sum of squares of digits    
    while(num > 0):    
        rem = num%10;    
        sum = sum + (rem*rem);    
        num = num//10;    
    return sum;    
        

def happy_num(num):
    result = num
    while(result != 1 and result != 4):
        result = isHappyNumber(result)
        
    if(result == 1):
        return True

        
    elif(result == 4):
        return False

l = []
for i in filter(happy_num,range(11)):
    if True:
        l.append(i)
        
print("All happy numbers between 0 and 100 are:",l)<jupyter_output><empty_output><jupyter_text>5.	Write a Python program to determine whether the given number is a Harshad Number?<jupyter_code>#Answer:<jupyter_output><empty_output><jupyter_text>6.	Write a Python program to print all pronic numbers between 1 and 100?<jupyter_code>#Answer:<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09750328515111695, 'fraction_numerical': 0.036005256241787124, 'mean_word_length': 2.096826688364524, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '352435', 'license': 'MIT', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1242, 'n_words': 425, 'path': 'Python Basic Programming/Python Basic Programming Assignment_9.ipynb', 'repo_name': 'Sayan97/Python', 'size': '3805'}