Python Challenge 7

Python Challenge 7

The code below shows you how to print the current data and time, run the code to check it out......

 

import datetime

now = datetime.datetime.now()

print ("Current date and time : ")

print (now.strftime("%Y-%m-%d %H:%M:%S"))

 

 

 

The code below allows you to enter your name and times how long it took you to respond.

  • See if you can extend the code to also allow the user to enter their age and other details such as email address, phone number or favourite colour.
  • See if you can develop the quizzes you have build previously to include a reaction timer.
  • See if you can develop the code into a maths quiz that allows the user to enter answers to sums (addition, subtraction etc).
  • Screen shot your code and add it to your programming notes, along with annotation explaining what it does.

 

import time
then = time.time()
print("Enter your name", end="")
result = str(input(" = "))
reaction_time = time.time()-then
print("You Entered:",result)
print("Reaction time:",reaction_time," Seconds")