[/NOPARSE] tags.def function():
pass
#test of logical signs#>, <, ==, !=
#8 questions
import random
user_name = input("===Welcome to the game=== \n ===Enter your name===\n :")
counter = 0
score = 0
while counter != 8: #only 8 questions
counter = counter + 1
number_one = random.randint (1,11) #number between 1 and 10
number_two = random.randint (1,11)
logical_sign = ['>','<','] #logic signs which user can input
random_sign = random.choice(logical_sign) #will generate a random from the given logical signs
print ("===",number_one, random_sign, number_two,"===") #prints out the problem
user_ans = input("===Please enter your answer 'False' or 'True=== \n").lower()
if random_sign == '>':
if number_one > number_two:
answer = 'true'
else:
answer = 'false'
elif random_sign == '<':
if number_one < number_two:
answer = 'true'
else:
answer = 'false'
elif random_sign == '==':
if number_one == number_two:
answer = 'true'
else:
answer = 'false'
elif random_sign == '!=':
if number_one != number_two:
answer = 'true'
else:
answer = 'false'
if user_ans == answer: #if the user input equals to the real answer of the sum give point
print ("Well Done")
score = score + 1
else:
print ("Sorry Wrong") #user gets no points
print (user_name, "===You have finished the game===")
print ("===Your score is ",score,"/8===")
#test of logical signs#>, <, ==, !=
#8 questions
import random
user_name = input("===Welcome to the game=== \n ===Enter your name===\n :")
counter = 0
score = 0
while counter != 8: #only 8 questions
counter = counter + 1
number_one = random.randint (1,11) #number between 1 and 10
number_two = random.randint (1,11)
logical_sign = ['>','<','] #logic signs which user can input
random_sign = random.choice(logical_sign) #will generate a random from the given logical signs
print ("===",number_one, random_sign, number_two,"===") #prints out the problem
user_ans = input("===Please enter your answer 'False' or 'True=== \n").lower()
if random_sign == '>':
if number_one > number_two:
answer = 'true'
else:
answer = 'false'
elif random_sign == '<':
if number_one < number_two:
answer = 'true'
else:
answer = 'false'
elif random_sign == '==':
if number_one == number_two:
answer = 'true'
else:
answer = 'false'
elif random_sign == '!=':
if number_one != number_two:
answer = 'true'
else:
answer = 'false'
if user_ans == answer: #if the user input equals to the real answer of the sum give point
print ("Well Done")
score = score + 1
else:
print ("Sorry Wrong") #user gets no points
print (user_name, "===You have finished the game===")
print ("===Your score is ",score,"/8===")
#test of logical signs#>, <, ==, !=
#8 questions
import random
user_name = input("===Welcome to the game=== \n ===Enter your name===\n :")
counter = 0
score = 0
def find_answer(random_sign, number_one, number_two):
if random_sign == '>':
if number_one > number_two:
return 'true'
else:
return 'false'
elif random_sign == '<':
if number_one < number_two:
return 'true'
else:
return 'false'
elif random_sign == '==':
if number_one == number_two:
return 'true'
else:
return 'false'
elif random_sign == '!=':
if number_one != number_two:
return 'true'
else:
return 'false'
def iterate():
global score
number_one = random.randint (1,11) #number between 1 and 10
number_two = random.randint (1,11)
logical_sign = ['>','<','] #logic signs which user can input
random_sign = random.choice(logical_sign) #will generate a random from the given logical signs
print ("===",number_one, random_sign, number_two,"===") #prints out the problem
user_ans = input("===Please enter your answer 'False' or 'True=== \n").lower()
answer = find_answer(random_sign, number_one, number_two)
if user_ans == answer: #if the user input equals to the real answer of the sum give point
print ("Well Done")
score = score + 1
else:
print ("Sorry Wrong") #user gets no points
while counter != 8: #only 8 questions
counter = counter + 1
iterate()
print (user_name, "===You have finished the game===")
print ("===Your score is ",score,"/8===")
[/NOPARSE] tags.def function():
pass
#test of logical signs#>, <, ==, !=
#8 questions
import random
user_name = input("===Welcome to the game=== \n ===Enter your name===\n :")
counter = 0
score = 0
def find_answer(random_sign, number_one, number_two):
if random_sign == '>':
if number_one > number_two:
return 'true'
else:
return 'false'
elif random_sign == '<':
if number_one < number_two:
return 'true'
else:
return 'false'
elif random_sign == '==':
if number_one == number_two:
return 'true'
else:
return 'false'
elif random_sign == '!=':
if number_one != number_two:
return 'true'
else:
return 'false'
def iterate():
global score
number_one = random.randint (1,11) #number between 1 and 10
number_two = random.randint (1,11)
logical_sign = ['>','<','] #logic signs which user can input
random_sign = random.choice(logical_sign) #will generate a random from the given logical signs
print ("===",number_one, random_sign, number_two,"===") #prints out the problem
user_ans = input("===Please enter your answer 'False' or 'True=== \n").lower()
answer = find_answer(random_sign, number_one, number_two)
if user_ans == answer: #if the user input equals to the real answer of the sum give point
print ("Well Done")
score = score + 1
else:
print ("Sorry Wrong") #user gets no points
while counter != 8: #only 8 questions
counter = counter + 1
iterate()
print (user_name, "===You have finished the game===")
print ("===Your score is ",score,"/8===")
a = (3, 5, {6, 4, 2}, 1, 0, "", [1, 2, 3, 4])
or a = 3, 5, {6, 4, 2}, 1, 0, "", [1, 2, 3, 4]
x, y = 2, 1
a = 3
b = "g"
a, b = b, a
def addtake(a, b):
return a + b, a - b
Last reply 1 minute ago
The Official Funding questions/moans/possible joy ThreadLast reply 2 minutes ago
BAE systems degree apprenticeships September 2024Last reply 4 minutes ago
LSE september 2024 grad intakeLast reply 4 minutes ago
Unsure of where to find student finance breakdownLast reply 7 minutes ago
Official University College London Applicant Thread for 2024Last reply 7 minutes ago
HSBC Degree Apprenticeship 2024Posted 7 minutes ago
Can I get an A/A* using claire bio and ms estruch vids for OCR A level biologyLast reply 7 minutes ago
Woodhouse College applicants 2024Last reply 7 minutes ago
Government Social Research - Research Officer Scheme 2024Last reply 10 minutes ago
Why are the grade requirements for Computer Science at Manchester University so high?Last reply 11 minutes ago
Official Royal Veterinary College Applicant Thread for 2024Last reply 12 minutes ago
Looking for fellow students! MMU Postgrad.Last reply 15 hours ago
Based on 2023 GCSEs, will grade boundaries be higher or lower in 2024?12
Last reply 18 hours ago
went from 3s to 9s with (literally) night before revision - ask me anything56
Last reply 15 hours ago
Based on 2023 GCSEs, will grade boundaries be higher or lower in 2024?12
Last reply 18 hours ago
went from 3s to 9s with (literally) night before revision - ask me anything56