Python Forum
Small Database Program (Need Help)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Small Database Program (Need Help)
#3
(Jul-11-2020, 03:06 AM)thewetmosquito Wrote: I want to carry out this process 3 times.
...
What can I add to my pre-existing code that won't break the program when ran?

There isn't a way for you to carry out the process 3 times without making any other changes to your code, but only a few changes would be needed. The simplest thing you could do would be to use a for loop like for _ in range(3) to loop through your code that gets user input and adds it to your database list.

If you add a for loop that runs lines 17 - 105, AND move the initialization of all your variables except database and months inside the loop, that will *almost* get you what you're looking for. Your database will end up being just one long list, instead of the list of lists you want, so you'll need to add a little additional code to handle that differently to get your desired output.
Reply


Messages In This Thread
RE: Small Database Program (Need Help) - by Larz60+ - Jul-11-2020, 03:21 AM
RE: Small Database Program (Need Help) - by GOTO10 - Jul-11-2020, 01:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  sqlite3 database does not save data across restarting the program SheeppOSU 1 3,474 Jul-24-2020, 05:53 AM
Last Post: SheeppOSU
  Small sqlite3 program error pythonNoob 5 3,668 May-10-2018, 05:45 PM
Last Post: pythonNoob
  Need small help on dynamic database connections Tirumal 4 3,486 Dec-28-2017, 07:02 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020