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 show rosbag file python 
Python :: matplotlib object oriented 
Python :: series floor 
Python :: sklearn grid search cross validation show progress 
Python :: ValueError: Please provide a TPU Name to connect to. site:stackoverflow.com 
Python :: python kiwi install 
Python :: python vars 
Python :: python convert xml to dictionary 
Python :: get admin url of instance django 
Python :: get all functions from a module as string list python 
Python :: pickle.load from gpu device to cpu 
Python :: sqlalchemy create engine Oracle 
Python :: get nonzero min numpy 
Python :: how to slice a set in python 
Python :: create django app 
Python :: img not responding jupyter notebook imshow 
Python :: seaborn bar plot sort for weekday 
Python :: convert pdf to excel python 
Python :: pandas array of dataframes 
Python :: get last save id django model 
Python :: opposite case in python 
Python :: python __add__ 
Python :: unique file name in django 
Python :: np append 
Python :: reverse a number in python 
Python :: dataframe rolling first eleemnt 
Python :: find the median of input number in a list and print 
Python :: python pip past 
Python :: typer python 
Python :: printed in a comma-separated sequence on a single line. 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =