@bdmessenger/

# DigitalRoot_Calculator

## No description

Files
• main.py
main.py
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
```
```#By: Brant Messenger

print(" --- Digital Root Calculator --- \n")

def checkValidInput(value):
temp = value
if temp.isdigit():
if int(temp) > 9:
return True
return False

def shutDown(value):
if value.lower() == "quit" or value.lower() == "q":
print("\nCalculator shutting down...")
quit()
return False

def calculator():
print("Please input a multiple-digit number: (q to quit)")
value = input()

shutDown(value)

while(shutDown(value) == False):

number = value
while(checkValidInput(number) != True):
if not number.isdigit():
print("\nInput is invalid. Please input a multiple-digit number:")
elif int(number) <= 9:
print("\nInvalid digit. Please input a multiple-digit number:")
value = input()
number = value
shutDown(value)
checkValidInput(value)

total = str(number)

digital_root = total
array_calculation = []

while(len(total) != 1):
current_value = 0
for i in list(total):
array_calculation.append(str(i))
current_value += int(i)
total = str(current_value)
display_calculation = ""
for n in range(len(array_calculation)):
if n != len(array_calculation)-1:
display_calculation += str(array_calculation[n]) + " + "
else:
display_calculation += str(array_calculation[n]) + " = " + str(total)
print("\n" + display_calculation)
array_calculation = []
display_calculation = ""

print("\nThe digital root of {} is {}.".format(digital_root,total))
print("\nPlease input a multiple-digit number: (q to quit)")
value = input()
shutDown(value)

calculator()```