Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reset Variable problem
#1
Hey guys Smile ,


Im making a rock paper scissors game, and i made a variable named 'wins'. I want it to keep track of how many times the user wins. I also want it to not reset every time I run the program again. Please respond if you know any functions to stop my variable from reseting.
Reply
#2
It sounds like you need to save the variable value (the number of user wins) to a file. Take a look at "shelve" module.
Reply
#3
You need to write the variable to a file or database (e.g. sqlite3).
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
thx guys it worked!
Smile Dance
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  dynamic variable name declaration in OOP style project problem jacksfrustration 3 759 Oct-22-2023, 10:05 PM
Last Post: deanhystad
  Variable from notepad problem samuelbachorik 2 2,289 Apr-10-2020, 09:04 AM
Last Post: samuelbachorik
  Problem: Get variable JohnnyCoffee 0 1,589 Feb-22-2020, 09:26 PM
Last Post: JohnnyCoffee
  Problem defining a variable rix 6 3,180 Dec-17-2019, 11:34 AM
Last Post: rix
  Reset a variable mln4python 4 8,371 Aug-19-2019, 08:28 AM
Last Post: mln4python
  Problem writing a variable value to Excel Chuck_Norwich 1 1,926 Jul-25-2019, 02:20 PM
Last Post: Chuck_Norwich
  Pass variable script return twice output problem Faruk 8 4,379 Dec-26-2018, 11:57 AM
Last Post: Faruk
  Problem with variable O_Pas_Sage 7 4,447 Aug-25-2018, 04:07 PM
Last Post: buran
  Trying to create a python exe for an addition problem with an odd variable Python_Newb 0 2,149 Nov-30-2017, 12:18 PM
Last Post: Python_Newb
  Problem With Scope Of A Variable Saif133 5 5,426 Jan-05-2017, 05:18 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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