Code
Sign up
Login
New paste
Home
Trending
Archive
English
Deutsch
English
Sign up
Login
New Paste
Browse
import time import random # List of 60 commonly used Linux commands linux_commands = [ "ls", "cd", "pwd", "mkdir", "rmdir", "rm", "cp", "mv", "touch", "cat", "echo", "grep", "find", "locate", "man", "chmod", "chown", "chgrp", "df", "du", "ps", "top", "kill", "wget", "curl", "tar", "zip", "unzip", "bzip2", "gzip", "nano", "vim", "vi", "apt", "yum", "dnf", "git", "svn", "docker", "docker-compose", "ssh", "scp", "rsync", "chmod", "chown", "ifconfig", "ip", "alias", "export", "history", "uptime", "shutdown", "reboot", "systemctl", "service", "journalctl", "mount", "umount", "echo", "sudo", "passwd", "useradd", "groupadd", "usermod", "groupmod", "ps aux", "htop", "free" ] # Developer and Disclaimer Information __author__ = "Jan Gebser" __version__ = "1.0" __license__ = "MIT" __email__ = "github@brainhub24.com" __date__ = "2024-11-13" # DISCLAIMER: # This code is for educational and recreational purposes only. # It is provided "as is", without warranty of any kind, express or implied, # including but not limited to the warranties of merchantability, fitness for a particular purpose, # and non-infringement. The author is not responsible for any direct, indirect, incidental, or consequential # damages arising from the use or misuse of this software. def typing_game(): """ Starts the typing game where the user has to type Linux commands within a given time. @param target_words: The number of commands the user must type to meet the goal. @param target_time: The time limit in seconds for the user to complete typing the target commands. @return: None (the function displays results and handles the game flow) """ # Set the target words and time target_words = 60 target_time = 60 # seconds print("Welcome to the Linux Commands Typing Game!") print(f"Your goal is to type {target_words} Linux commands in {target_time} seconds!") print("Type the following commands as quickly as you can when prompted.") input("Press Enter to start...") # Timer starts now start_time = time.time() words_typed = 0 word_accuracy = 0 # Loop until time runs out while True: # Select a random command from the list command = random.choice(linux_commands) print(f"Type this command: {command}") # Get user input typed_command = input("Your input: ").strip() # Check if user typed the command correctly if typed_command == command: words_typed += 1 # Calculate elapsed time elapsed_time = time.time() - start_time # End the game if time is up or the user reached the word target if elapsed_time >= target_time or words_typed >= target_words: break # Calculate total time taken and score end_time = time.time() total_time = end_time - start_time score = (words_typed / target_time) * 100 # Score based on words typed per second print("\nGame Over!") print(f"Total time: {total_time:.2f} seconds") print(f"Words typed: {words_typed}/{target_words}") print(f"Your score: {score:.2f} points") # Determine if user met the target if words_typed >= target_words: print(f"Congratulations! You met the target of {target_words} words in {target_time} seconds!") else: print(f"Sorry, you didn't reach the target. Try again to improve your speed!") # Run the game if __name__ == "__main__": typing_game()
Paste Settings
Paste Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax Highlighting :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Paste Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create New Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
Deutsch
English
Do you like cookies?
🍪 We use cookies to ensure you get the best experience on our website.
Learn more
I agree