Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I start from the beginning of the code while keeping the string value?

I need to go to line 14 of this code after the code has finished running. How would I do that?

from replit import db
import getpass
import sys

def signup():
    db["User"] = input("Enter username:\n")
    db["Pass"] = getpass.getpass("Enter Password:\n")


def login():
    print("WIP")


LorS = int(input("Login or Signup? (0 for login, 1 for Signup)\n")) # line 14

if LorS == 1:
    signup()
elif LorS == 0:
    login()
else:
    sys.exit()

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

You loop it and then exit whenever you want to.

from replit import db
import getpass
import sys
def signup():
   db["User"] = input("Enter username:\n")
   db["Pass"] = getpass.getpass("Enter Password:\n")
def login():
   print("WIP")
while True:  # you loop until you want to exit ---------
   LorS = int(input("Login or Signup? (0 for login, 1 for Signup)\n"))

   if LorS == 1:
       signup()
   elif LorS == 0:
       login()
   elif LorS != 1 or 2:
       sys.exit()
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading