The purpose of this entry is to capture the basics of Python in Jupyter.

Greetings

This greeting code uses a simple print command.

print("Hello, please go ahead and try to don't fail the quiz!")          # a greeting

The following code sequences provide a quiz about the basics of Python by using those basics:

import: Includes functions that were previously developed.

def: def/function/procedure; used for defining a function usually at the beginning of a sequence.

prompt: A message output to the user to describe the input requested.

msg: Short for message, used to capture input command.

Questions, answers and responses are defined using these basics.

Rsp and if/else commands will be used for evaluating scores.

Part 1: Mr. Mortensen's Questions

import getpass ,sys

def question_and_answer(prompt):            # defining the Q&A Function    
    print("Question: " + prompt)
    msg = input()
    print("Answer: " + msg)
    
def question_with_response(prompt):
    print("Question: " + prompt)
    msg = input()
    return msg

questions = 3           # number of questions
correct = 0            # running score

print('Hello, ' + getpass.getuser() + " running " + sys.executable)             # greetings

print("You will be asked " + str(questions) + " questions.")            # the number of questions is presented here
question_and_answer("Are you ready to take a test?")            # this question does not need a correct answer since it's not using an rsp variable

rsp = question_with_response("What command is used to include other functions that were previously developed?")             # the following questions require a correct answer since they are using an rsp variable
if rsp == "import":            # correct answer
    print(rsp + " is correct!")             # response to a correct answer
    correct += 1                   # gain points by answering correctly
else:                 # giving an incorrect answer
    print(rsp + " is incorrect!")               # response to an incorrect answer

rsp = question_with_response("What command is used to evaluate correct or incorrect response in this example?")
if rsp == "if":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")

rsp = question_with_response("Each 'if' command contains an '_________' to determine a true or false condition?")
if rsp == "expression":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")

print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))              # marks the end of the quiz
Hello, manimani running /bin/python3
You will be asked 3 questions.
Question: Are you ready to take a test?
Answer: Yes
Question: What command is used to include other functions that were previously developed?
import is correct!
Question: What command is used to evaluate correct or incorrect response in this example?
if is correct!
Question: Each 'if' command contains an '_________' to determine a true or false condition?
expression is correct!
manimani you scored 3/3

Part 2: My Questions

import getpass ,sys

questions = 3
correct = 0

rsp = question_with_response("What is the classic greetings in Python?")
if rsp == "Hello, World!":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")

rsp = question_with_response("What command activates the jupyter notebook input box?")
if rsp == "input":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")
    
rsp = question_with_response("Where is the false branch of code in an if command?")
if rsp == "else":
    print(rsp + " is correct!")
    correct += 1
else:
    print(rsp + " is incorrect!")
    
print(getpass.getuser() + " you scored " + str(correct) +"/" + str(questions))
Question: What is the classic greetings in Python?
Hello, World! is correct!
Question: What command activates the jupyter notebook input box?
input is correct!
Question: Where is the false branch of code in an if command?
else is correct!
manimani you scored 3/3

The end of the quiz. Have a nice day!

Additional Resources:

These CollegeBoard videos are great for learning more about Python.