Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

random question generator python

import random
# from random import choice
questions = ['Question1', 'Question2', 'Question3']
random_item = random.choice(questions)

print (random_item)
Comment

how to make a random question generator in python

num1 = random.randint(1, 10)

num2 = random.randint(1, 10)

answer = int(input(f"What is {num1} + {num2}?
"))

if answer == (num1 + num2):
    print("Correct")

else:
    print("Wrong")
Comment

PREVIOUS NEXT
Code Example
Python :: how to load wav file with python 
Python :: django signup view 
Python :: python turtle commands 
Python :: python google chrome 
Python :: regex findall 
Python :: python datetime module 
Python :: python tkinter change color of main window 
Python :: pandas change dtype to timestamp 
Python :: python file parent 
Python :: python try except raise error 
Python :: datetime to int in pandas 
Python :: How to Create a Pandas DataFrame of Random Integers 
Python :: how to check if any item in list is in anoter list 
Python :: how can item in list change in int in python 
Python :: how to delete a file in python 
Python :: loop through python object 
Python :: time addition in python 
Python :: python file reading 
Python :: python pop element 
Python :: django content type 
Python :: import os 
Python :: rotate image in pygame 
Python :: python recurrent timer 
Python :: concat dataframes 
Python :: como leer lineas de un archivo de texto en python 
Python :: python env 
Python :: kafka get last offset of topic python 
Python :: os.chdir python 
Python :: scroll down selenium python 
Python :: press key on python 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =