Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #creating a function so I don't need to save into txt file
- def main():
- #file for answers.txt
- file = open("answers.txt", "w")
- #Asking for first and lastname
- fname = raw_input("Input your First Name : ")
- lname = raw_input("Input your Last Name : ")
- print ("Hello Good Luck " + fname + " " + lname)
- #creating questions and using if statement
- questions1 = raw_input("What is 1+1? ")
- answer1 = ("2")
- if questions1 == answer1:
- print("correct answer")
- elif questions1 != answer1:
- print("incorrect answer")
- question2 = raw_input("What is 1+2 ?")
- answer2 = ("3")
- if question2 == answer2:
- print("correct answer")
- elif question2 != answer2:
- print("incorrect answer")
- question3 = raw_input("What is 4+2 ?")
- answer3 = ("6")
- if question3 == answer3:
- print("correct answer")
- elif question3 != answer3:
- print("incorrect answer")
- question4 = raw_input("What is 1-1 ?")
- answer4 = ("0")
- if question4 == answer4:
- print("correct answer")
- elif question4 != answer4:
- print("incorrect answer")
- question5 = raw_input("What is 2 * 5 ?")
- answer5 = ("10")
- if question5 == answer5:
- print("correct answer")
- elif question5 != answer5:
- print("incorrect answer")
- ~
- ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement