Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def signup(): #this creates the function called signup.
- username = "Jack" #sets the variable "Jack" as the username.
- password = "password1" #sets the variable "password1" as the password.
- username1 = str(input("What is the username? ")) #asks for the username
- password1 = str(input("What is the password? ")) #asks for the password
- if username1 == username and password == password1: #if the U and P are correct it prints "Welcome to the program"
- print ("Welcome to the program!")
- elif username1 and password1: #when it is wrong it repeats the function.
- print ("Incorrect Username or Password.")
- print ("Please try again...")
- signup()
- def mainMenu():
- print (" 1) Option 1")
- print (" 2) Option 2")
- print (" 3) Option 3")
- opt = int(input("Enter your choice: "))
- while opt >= 4:
- print ("That is not a valid option. Please try again...")
- opt = int(input("Enter your choice: "))
- if opt == (1):
- print ("You have chosen option 1! ")
- rand()
- mainMenu()
- elif opt == (2):
- print ("You have chosen option 2! ")
- elif opt == (3):
- print ("You have chosen option 3! ")
- def rand():
- ListName = []
- file = open("songs.txt", "r")
- for line in file:
- ListName.append(line)
- file.close()
- #Fluff at the bottom
- signup() #adding this makes it so you dont have to type in "signup()" at the beginning.
- mainMenu() #adding this makes it so you dont have to type in "mainMenu()" at the beginning.
- '''def rand():
- lines = open('songs.txt').read().splitlines()
- myline =random.choice(lines)
- song = myline
- songselect = song[:1]
- print (songselect)'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement