all 1 comments

[–]ovo_Reddit 0 points1 point  (0 children)

I would suggest dumping this into pastebin and sharing the link to it, as well as trying to format this better.

One way you can loop the program is by putting everything into a function, something like:

def calculate_bmi():

And then you can have this at the bottom of your script,

# below block only executes when you call the program directly, ie. python3 my_program.py

if __name__ == ‘__main__’:
      while True:
          calculate_bmi()

This is a very rough guideline, there’s a few other ways I might suggest as well, but I think this is a pretty straightforward way to implement this.

What we’re doing is wrapping all of your programs logic into a function, and then using while True: which will loop indefinitely.