Skip to content

Instantly share code, notes, and snippets.

@pavanb0
Last active November 21, 2023 17:48
Show Gist options
  • Select an option

  • Save pavanb0/2012979ffe6908865f4e7deef8c0d517 to your computer and use it in GitHub Desktop.

Select an option

Save pavanb0/2012979ffe6908865f4e7deef8c0d517 to your computer and use it in GitHub Desktop.

Revisions

  1. pavanb0 revised this gist Nov 21, 2023. No changes.
  2. pavanb0 revised this gist Sep 1, 2023. No changes.
  3. pavanb0 created this gist Mar 3, 2022.
    83 changes: 83 additions & 0 deletions python_typing_speed _meter_consol
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,83 @@
    #created by pavan 2022
    import re
    import time
    import random
    t1="It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout."
    t2="There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form,"
    t3="All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary,"
    t4="encompasses the social behavior and norms found in human societies, as well as the knowledge, beliefs, arts, laws, customs"
    t5="India is a country in South Asia whose name comes from the Indus River. The name 'Bharata' is used as a designation for the country in their constitution"
    lista=[t1,t2,t3,t4,t5]
    text=random.choice(lista)
    splt_text=re.split( "\s" ,text)
    splt_text_length=(len(splt_text))
    print(splt_text[0])
    user_respose="encompasses the social behavior and norms found in human societies, as well as the knowedge, beliefs, arts, laws, customs"
    split_user_response=re.split("\s",user_respose)
    def wpma_pass (host,guest,length):
    flag_1=0
    flag_2=0
    while True:
    for i in range(length):
    if guest[i] in host:
    flag_1=flag_1+1
    if guest[i] not in host:
    flag_2=flag_2+1
    return [flag_1,flag_2];
    break;

    def lengt_of_user_In(userin,lengt_of_text):
    i=len(userin)
    #if i <
    return i;

    def wpmcalculator(right_word,time_that_user_took_in_minutes):

    iowa=right_word[0]/time_that_user_took_in_minutes
    return iowa;

    def wrong_words(rightwords):

    return (print("you hit:\ ",rightwords[1],"wrong words"));

    def right_q(righwords):
    return (print("you hit ☺ ", righwords[0], "correct words"));


    def secon_to_minute_converter(sec):
    minutes=sec/60
    return minutes;

    def speed_reaction(wpmspeed):
    if wpmspeed>50:
    print("you are genius")

    print("welcome to 'type o metre' check your typing speed and accurecy")
    response=str(input("would you like to begine with thise test:/|\: (yes/no)"))
    response.lower()
    if response=="yes":
    print("-------------------------------------------------------------------------")
    print("we will throw 1 line at time ready!!!!!!!!!")
    print("-------------------------------------------------------------------------")
    res = str(input(" will start ready (yes/no)"))
    res.lower()
    if res=="yes":
    print(text)
    start=time.time()
    user_respose=str(input())
    end=time.time()
    time_that_user_took_for_typing_in_seconds=(end-start)
    split_user_response=re.split("\s", user_respose)
    length_of_user_response=lengt_of_user_In(split_user_response,splt_text_length)
    right_words=wpma_pass(splt_text,split_user_response,length_of_user_response)
    time_that_user_took_for_typing_in_minutes=secon_to_minute_converter(time_that_user_took_for_typing_in_seconds)
    wpmspeed=wpmcalculator(right_words,time_that_user_took_for_typing_in_minutes)
    wrong=(wrong_words(right_words))
    right=(right_q(right_words))
    print("you type around ",wpmspeed, " words per minutes ")
    else:
    print("bye")
    else:
    print("bye")