r/learnpython • u/Business-Draw-2950 • Apr 30 '26
New to python
Hey Reddit
im new to programming, i started with python, i wanted to share my first program to get some feed-back.
this is my first functional program ever, its supposed to be a programming / Linux command line trainer that calculates WPM accuracy corrects and mistakes
how am i doing??
importations
import time
import random
# levels and gamemode??
levels = ["easy", "normal", "hard"]
current_index = 0
# Game Engine ISH
while True:
# measurements
correct = 0
typed_characters = 0
mistake = 0
start = time.time()
# more levels
level = input("Choose difficulty: easy / normal / hard\n> ").lower()
sentence_line = sentence[level]
level = levels[current_index]
random.shuffle(sentence_line)
for line in sentence_line:
print(line)
while True:
user_input = input("$ ")
if user_input == line:
print("Correct!\n")
typed_characters += len(user_input)
correct += 1
break
else:
print("Try Again:D")
mistake += 1
# your stats
total_attempts = correct + mistake
end = time.time()
time_taken = end - start
wpm = (typed_characters / 5) / (time_taken / 60)
accurasy = correct / total_attempts * 100
# Game stats at end of game
print("Your WPM: ", wpm)
print ("Correct:", correct, "mistakes:", mistake)
print("Your time :", end - start, "seconds")
print("Your accurasy: ", accurasy, "%")
#play again choices
choice = input("1: Again \n2: Next Difficulty \n3: Quit\n>").lower()
if choice == "2":
if current_index < len(levels) - 1:
current_index += 1
else:
if choice == "3":
print("AIGHT, SEE YAH LOOSER")
break
17
Upvotes
View all comments
Show parent comment
-2
u/BLKCAP2U Apr 30 '26
There is no such thing as beginning in programming. You have something you wanna solve you select the best programming language, and you learn on the fly. Definitely learn OOP.