0
count = 0

def lol(count):
    x = count + 1
    print(x)

Currently i am calling this function within another file in my python program, and count is = 1 everytime it is ran, im unsure why, im trying to make it +1 after every time it is ran.

Any help would be greatly appriciated.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
8au
  • 25
  • 1
  • 7
  • It will always just print count+1 because that what the code does. In fact the above code won't do anything because you never call lol() – JeffUK Dec 11 '20 at 17:31

1 Answers1

1

You are never modifying count, and only printing the result of x = 0 + 1

This would do what you want, however, you should re-consider your need for global variables

count = 0

def lol():
    global count
    count += 1
    print(count)
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245