mathquiz.py
parent
4e48f04744
commit
6ccb592191
@ -1,7 +1,12 @@
|
|||||||
from random import randint
|
question1 = "What is science ?"
|
||||||
|
question2 = "What is UFW ?"
|
||||||
|
question3 = "What is HTML "
|
||||||
|
question4 = "What is CSS ?"
|
||||||
|
|
||||||
|
answer1 = "Uncomtrollable Fireware"
|
||||||
|
|
||||||
num1 = randint(1, 10)
|
questions = [question1,question2,question3,question4]
|
||||||
num2 = randint(1, 10)
|
for question in questions:
|
||||||
question = "What is " + str(num1) + " times " + str(num2) + "? "
|
if questions == :
|
||||||
answer = int(input(question))
|
|
||||||
|
print(question)
|
||||||
|
@ -1,33 +1,79 @@
|
|||||||
from random import randint
|
from random import randint
|
||||||
print("What is 7 times 2?")
|
value1 = randint(1,10)
|
||||||
value1 = int(input ("first value"))
|
value2 = randint(1,10)
|
||||||
value2 = int(input("second value"))
|
|
||||||
if value1 * value2 == 14:
|
|
||||||
print("This is your answer " + str (value1*value2))
|
|
||||||
else:
|
|
||||||
print("Try again!!")
|
|
||||||
|
|
||||||
|
#Challenge 1
|
||||||
|
answer1 = value1 * value2
|
||||||
|
print("What is " + str(value1) + " time " + str(value2) + "\n",answer1)
|
||||||
|
|
||||||
#Challenge 2
|
#Challenge 2
|
||||||
print("Enter any two valid number to know it sum")
|
answer2 = value1 + value2
|
||||||
number1 = int(input("first number"))
|
print("What is " + str(value1) + " plus " + str(value2) + "\n",answer2)
|
||||||
number2 = int(input("second number"))
|
|
||||||
print("Your answer is " + str(number1+number2))
|
|
||||||
|
|
||||||
#Challenge 3
|
#Challenge 3
|
||||||
print("What is 7 time 3")
|
print("What is", value1, "times" , value2)
|
||||||
numberOne = int(input("Type in your answer now"))
|
user_input = int(input("type your answer "))
|
||||||
if numberOne == 21:
|
|
||||||
print(numberOne)
|
if value1 * value2 == user_input:
|
||||||
|
print(user_input , "Is correct")
|
||||||
|
|
||||||
|
elif value1 * value2 != user_input:
|
||||||
|
print(user_input , "Is not correct")
|
||||||
|
|
||||||
|
#Challlenge 4
|
||||||
|
repeatNumber = randint(5,50)
|
||||||
|
for numbers in range(5):
|
||||||
|
print("your output is ",numbers)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Challenges 5:
|
||||||
|
print("What is", value1, "times" , value2)
|
||||||
|
print("What is", value1, "times" , value2)
|
||||||
|
user_input = int(input("type your answer "))
|
||||||
|
|
||||||
|
if value1 * value2 == user_input:
|
||||||
|
print(user_input , "Is correct")
|
||||||
|
|
||||||
|
elif value1 * value2 != user_input:
|
||||||
|
print(user_input , "Is not correct")
|
||||||
|
print("The correct answer is ",value1*value2)
|
||||||
|
|
||||||
|
|
||||||
|
#Challenges 6 coming soon
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Challenge 4
|
|
||||||
RandomNumber = randint(10,20)
|
|
||||||
print(RandomNumber)
|
|
||||||
print(RandomNumber)
|
|
||||||
print(RandomNumber)
|
|
||||||
print(RandomNumber)
|
|
||||||
print(RandomNumber)
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue