0

Hey there,

I am trying to create a register code. So basicly im making a quiz and every time a user starts up my program he/she needs to register (making a unique username/pass)
-When registered it will ask to login.

Could anyone help me make the code? My code so far is bellow

#Login
test_u="Amy"
test_p="1234"
loggedIn=False

while loggedIn == False:

    print("Please log in")
    u=input("Enter test username")
    if test_u==u:
        p=input("Enter test password")

# Defining Score variables 
x = 0
score = x
pass

# Question One 
print("When did WW2 finish?")
answer_1 = input("a)2001\nb)1945\nc)1877\nd)1940\n:")
if answer_1.lower() == "b" or answer_1.lower() == "2":
    print("Correct")
    x = x + 1   
else:
    print("Incorrect, the second Worl War ended in 1945")

# Question Two
print("Who was responsilbe of most deaths in World War 1 & 2 ")
answer_2 = input("a)Donald Trump\nb)Adolf Hitler\nc)Tom Cruisend\nd)There were no WAR\n:")
if answer_2.lower() == "b" or answer_2.lower() == "Adolf Hitler":
    print("Correct")
    x = x + 1
else:
    print("Incorrect, It was Adolf Hitler who took around 12 to 14 million lives")

# Question Three
print("True or False... Hitler was a painter")
answer_3 = input(":")
if answer_3.lower() == "true" or answer_3.lower() == "t":
    print("Correct")
    x = x + 1
else:
    print("Incorrect")  

# Question Four
print("What happened in Chernobyl")
answer_4 = input("a)Nuclear Plant exploaded\nb)Water Flood\nc)Alien Envasion\nd)War\n:")
if answer_4.lower() == "a" or answer_4 == "1967":
    print("Correct")
    x = x + 1
else:
    print("Incorrect, the nuclear plant exploaded")

# Question Five 
print("True or False... Everybody knew the reactor will explode")
answer_5 = input(":")
if answer_5.lower() == "false" or answer_5.lower() == "f":
    print("Correct")
    x = x + 1
else:
    print("Incorrect, no one knew it will explode")

#Total Score
score = float(x / 5) * 100
print(x,"out of 5, that is",score, "%")
2
Contributors
2
Replies
22
Views
8 Months
Discussion Span
Last Post by Adam_40
0

Well spot out. Thank you, can you still help me resolve my issue?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.