[Solved] How can I fix this program? (python) [closed]


Try this:

# -*- coding: utf-8 -*-
max_value = 5


#The main function, it only summons the other functions and gets an input for num1.

#If the value entered in the functions is not ok, a loop happens in the main function.
def main():
    global max_value
    #This line requests from you to put an input with 5 digits
    num1 = input("Please enter a number with 5 digits\n")
    bol = check_everything(num1)
    if bol == False:
        while (len(num1) != max_value) or (num1.isdigit() == False):
            num1 = input("Please enter a number with 5 digits and with digits only\n")
    num1 = int(num1)
    printer(num1)


def check_everything(num1):
    if (len(num1) == max_value) and (num1.isdigit() == True):
        return True
    else:
        return False


def printer(num1):
    numsum = 0
    s1 = ''
    for x in range(max_value):
        s1 += str(num1)[x] + ','
    print(s1[:-1:])
    for i in range(len(str(num1))):
      numsum = numsum + int(str(num1)[i:i+1])
    print(str(numsum))


if __name__ == '__main__':
  main()

solved How can I fix this program? (python) [closed]