Here is my latest version of my addition script. I have tried to take on all the advice I have been given by people like @Janos and @Hosch250 and also tried to keep to the guidelines set by the PEP8 (I recommend it to anyone who hasn't read it yet). Now I have done it, so please tell me if I have missed anything/there is a way to improve.

def main():
pass

def space():
print(" ")

if __name__ == '__main__':
main()

Previous1=0
Repeat=True
Numbers=[]
space()
print("Type 0 to end")
while Repeat:
Repeat=False
for num in Numbers:
print('{} + {} = '.format(num, Previous1))
Previous1 += num
space()
print(Previous1)
space()
space()
input("/n Press ENTER to exit the program")

• Also, I know I am going off on a tangent here, but is there a way to change the colour of the output text? – Joe Dec 12 '15 at 19:43
• Did you actually read the PEP-8 guide? What did it tell you about variable namings? – Barry Dec 12 '15 at 19:49
• You should use conventions – Joe Dec 12 '15 at 19:51
• It is too late to edit it because it would invalidate the answer. – user34073 Dec 12 '15 at 19:55
• You should add a link to the last question so people can compare the two and see were you where compared to now. – 13aal Dec 12 '15 at 20:08

First things first, PEP-8 recommends snake_case for variable namings. So definitely numbers, repeat, add_number, etc. Also Previous1 isn't a great name - what is the number doing there? Perhaps sum_so_far?

Getting all the Inputs

input() will raise EOFError when we run out of numbers, and the float() conversion will raise ValueError if the user enters not a float. Rather than having a sentinel value input (what if I want to do 1+2+0+4+5?), just use what the language already provides:

def input_numbers(prompt):
numbers = []
while True:
try:
numbers.append(float(input(prompt)))
except ValueError:
# maybe print an error
except EOFError:
break
return numbers


main() and space()

What is main() doing? I could understand:

def main():
# all the logic here

if __name__ == '__main__':
main()


space() is useless.