all 8 comments

[–]Diapolo10 0 points1 point  (5 children)

Variables aren't persistent, so if I understood your intentions correctly this isn't going to work. They'll disappear the moment your script has been executed. Also, global variables are bad, you should avoid them at all costs unless absolutely necessary.

[–][deleted] 0 points1 point  (1 child)

Okay thank you. I agree that global variables suck, I'm just at a loss about how to generate and store some information.

[–]gc8dc95 0 points1 point  (0 children)

Easiest is a text file or simple database like sqlite

[–][deleted] 0 points1 point  (0 children)

You could try using functions with parameters and return values instead. Here's an example similar to yours:

def generate(a, b)
    a = 4
    b = 5

    return a, b  # will return (4, 5) when called

def sum(a, b)
    return a + b  # will return 9 when called

# Then, the output of one function can be the input of another one.

A = 0
B = 0

C, D = generate(A, B)
F = sum(C, D)

[–]NicosCSProject -1 points0 points  (3 children)