From 6ccb592191ae3295148c82f0dd10643ad0679fdc Mon Sep 17 00:00:00 2001 From: Spencerscooper Date: Tue, 18 Jul 2023 09:51:08 +0000 Subject: [PATCH] mathquiz.py --- Summer-Time-W-Jeff/challenge3.py | 15 ++++-- Summer-Time-W-Jeff/firstprog.py | 5 ++ Summer-Time-W-Jeff/mathquiz.py | 90 ++++++++++++++++++++++++-------- 3 files changed, 83 insertions(+), 27 deletions(-) diff --git a/Summer-Time-W-Jeff/challenge3.py b/Summer-Time-W-Jeff/challenge3.py index 7f88d88..dc2a8e2 100644 --- a/Summer-Time-W-Jeff/challenge3.py +++ b/Summer-Time-W-Jeff/challenge3.py @@ -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) -num2 = randint(1, 10) -question = "What is " + str(num1) + " times " + str(num2) + "? " -answer = int(input(question)) +questions = [question1,question2,question3,question4] +for question in questions: + if questions == : + + print(question) diff --git a/Summer-Time-W-Jeff/firstprog.py b/Summer-Time-W-Jeff/firstprog.py index df0b191..f48342e 100644 --- a/Summer-Time-W-Jeff/firstprog.py +++ b/Summer-Time-W-Jeff/firstprog.py @@ -1,3 +1,5 @@ +import time + from gasp import * from random import randint @@ -37,3 +39,6 @@ end_graphic() randint(10,15) + +time.strftime("%A, %d %B %Y, at %I:%M%p", time.localtime(time.time())) +print(time) diff --git a/Summer-Time-W-Jeff/mathquiz.py b/Summer-Time-W-Jeff/mathquiz.py index 7df82fd..66e49eb 100644 --- a/Summer-Time-W-Jeff/mathquiz.py +++ b/Summer-Time-W-Jeff/mathquiz.py @@ -1,33 +1,79 @@ from random import randint -print("What is 7 times 2?") -value1 = int(input ("first value")) -value2 = int(input("second value")) -if value1 * value2 == 14: - print("This is your answer " + str (value1*value2)) -else: - print("Try again!!") +value1 = randint(1,10) +value2 = randint(1,10) +#Challenge 1 +answer1 = value1 * value2 +print("What is " + str(value1) + " time " + str(value2) + "\n",answer1) #Challenge 2 -print("Enter any two valid number to know it sum") -number1 = int(input("first number")) -number2 = int(input("second number")) -print("Your answer is " + str(number1+number2)) +answer2 = value1 + value2 +print("What is " + str(value1) + " plus " + str(value2) + "\n",answer2) + + #Challenge 3 -print("What is 7 time 3") -numberOne = int(input("Type in your answer now")) -if numberOne == 21: - print(numberOne) +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") + +#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) + +