loops - I am trying to create a code for the exercise below in python (for school) and I am stuck -


create program time how long takes user type in alphabet correctly. not stop timer until have correctly typed in , if make mistake show message , have try type in again. once have managed type in alphabet correctly tell them how long took them , ask them if want try again see if can beat previous time.

i managed first part:

import time  starttime = time.time()  def ask_question1(): answer1= input("type in alphabet fast can press enter: ") return answer1  if __name__=="__main__":     answer1=ask_question1()     while answer1 != "abcdefghijklmnopqrstuvwxyz":         print("you made mistake. ")         answer1=input("try again: ")  endtime=time.time() print("it took ",round(endtime-starttime, 2), " seconds") 

but can't make ask question again , repeat process.

it seems need call ask_question1 instead of answer1=input("try again: ")


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -