Is there a way to go back to the beginning of a function using an if gate?
TristanMisja (6)

NOTE: This is only a sample of the code, and it won't show tabs.

import sys
import os
import string
import math
import colorama
import time

def login():
global username
global password
uy = None
username = input("What is your username?\n\t")
uy = input("Username is " + username + ". Is this true? (y/n)")
if uy == "y":
elif uy == "n":
#This is where I want it
password = getpass.getpass("What is your password?\n\t")
cp = getpass.getpass("Confirm your password:\n\t")
if cp == password:
#This is also where I want it

You are viewing a single comment. View All
heyitsmarcus (285)

@TristanMisja You absolutely can do that. Here is a repl with the code I talked about: https://repl.it/@heyitsmarcus/Python-Username-Password