Texts

Below you will find a set of texts used on TypeRacer. Certain texts only appear on certain difficulties.

Sorted by difficulty rating compared to other texts

Show abbreviated texts

Rank ID Text Length Races Difficulty Rating Top Score Top 100 Average Active Since
1. #0 This is a placeholder text. You are seeing it because there are no other texts available for your skill level. Please tell your system administrator to add some texts! 167 579 1.275 195.88Sean Wrona (arenasnow2) 157.69 103.83 May 18, 2010
2. #10009 input("\n\nPress the enter key to exit.") # waits for the user to press the Enter key 85 5,325 1.210 197.14realboot (sahibprime) 145.62 73.76 September 15, 2012
3. #10019 import string from random import * characters = string.ascii_letters + string.punctuation + string.digits password = "".join(choice(characters) for x in range(randint(8, 16))) print password 190 3,670 1.180 179.63chillin (slekap) 130.90 67.17 October 3, 2018
4. #10017 import random min = 1 max = 6 roll_again = "yes" while roll_again == "yes" or roll_again == "y": print "Rolling the dices..." print "The values are...." print random.randint(min, max) print random.randint(min, max) roll_again = raw_input("Roll the dices again?") 272 2,863 1.137 145.67chillin (slekap) 112.46 60.33 October 3, 2018
5. #10018 import random n = random.randint(1, 99) guess = int(raw_input("Enter an integer from 1 to 99: ")) while n != "guess": print if guess < n: print "guess is low" guess = int(raw_input("Enter an integer from 1 to 99: ")) elif guess > n: print "guess is high" guess = int(raw_input("Enter an integer from 1 to 99: ")) else: print "you guessed it!" break print 388 3,339 1.106 136.71leonidas (awsomaw) 121.77 67.08 October 3, 2018
6. #10024 template<typename ...Args> bool all(Args ...args) { return (... && args); } bool b = all(true, true, true, false); // Within the instantiation of all, the returned expression expands to ((true && true) && true) && false, which evaluates to false. 246 11 1.067 67.25Jay (kamikamigod) 45.08 45.08 December 4, 2023
7. #10020 import urllib2 import json screen_name = "wordpress" url = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=" + screen_name data = json.load(urllib2.urlopen(url)) print len(data), "tweets" for tweet in data: print tweet['text'] 246 2,515 1.054 137.02 (sidd_) 99.93 52.32 October 3, 2018
8. #10010 public class HelloWorld { public static void main(String[] args) { String message = "Hello World!!!"; System.out.println(message); } } 143 3,201 1.052 134.85leonidas (awsomaw) 105.94 53.38 December 29, 2017
9. #10006 print "Using URL", url req = urllib2.Request(url) fd = urllib2.urlopen(req) while 1: data = fd.read(1024) if not len(data): break sys.stdout.write(data) 152 5,317 1.041 135.48www.tunnel.dev (leondreamed) 107.41 51.66 November 19, 2009
10. #10002 import os import sys def run(program, *args): pid = os.fork() if not pid: os.execvp(program, program + args) return os.wait()[0] run("python", "hello.py") 154 5,494 1.041 142.4520mg (chakk) 105.38 50.89 December 5, 2009
11. #10001 /** Loop waiting for a connection and a valid command */ while (true) { Socket socket = null; InputStream stream = null; try { socket = serverSocket.accept(); socket.setSoTimeout(10 * 1000); stream = socket.getInputStream(); } catch (AccessControlException ace) { log.warn("StandardServer.accept security exception: " + ace.getMessage(), ace); continue; } catch (IOException e) { log.error("StandardServer.await: accept: ", e); System.exit(1); } 445 3,414 1.030 133.72www.tunnel.dev (leondreamed) 99.61 53.84 December 13, 2009
12. #10015 function calculateArea(width, height) { try { var area = width * height; if (!isNaN(area)) { return area; } else { throw new Error('calculateArea() received invalid number'); } } catch(e) { console.log(e.name + ' ' + e.message); return 'We were unable to calculate the area.'; } } 301 2,564 1.025 133.59 (sidd_) 98.82 51.06 October 4, 2018
13. #10000 /* Read a set of characters from the socket */ StringBuffer command = new StringBuffer(); int expected = 1024; /* Cut off to avoid DoS attack */ while (expected < shutdown.length()) { if (random == null) random = new Random(System.currentTimeMillis()); expected += (random.nextInt() % 1024); } while (expected > 0) { int ch = -1; try { ch = stream.read(); } catch (IOException e) { log.warn("StandardServer.await: read: ", e); ch = -1; } if (ch < 32) /* Control character or EOF terminates loop break; command.append((char) ch); expected--; } 542 2,551 0.994 124.87chillin (slekap) 96.27 52.40 December 19, 2009
14. #10005 class URLLister(SGMLParser): def reset(self): SGMLParser.reset(self) self.urls = [] def start_a(self, attrs): href = [v for k, v in attrs if k=='href'] if href: self.urls.extend(href) 183 4,606 0.977 125.80morning (chakkonmech) 100.58 48.52 November 19, 2009
15. #10016 import re import sys import urllib2 import BeautifulSoup usage = "Run the script: ./geolocate.py IPAddress" if len(sys.argv)!=2: print(usage) sys.exit(0) if len(sys.argv) > 1: ipaddr = sys.argv[1] geody = "http://www.geody.com/geoip.php?ip=" + ipaddr html_page = urllib2.urlopen(geody).read() soup = BeautifulSoup.BeautifulSoup(html_page) 344 2,198 0.970 128.63Sean Wrona (arenasnow) 91.08 47.04 October 3, 2018
16. #10021 import urllib2 import urllib import json url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&" query = raw_input("What do you want to search for ? >> ") query = urllib.urlencode( {'q' : query } ) response = urllib2.urlopen (url + query ).read() data = json.loads ( response ) results = data [ 'responseData' ] [ 'results' ] for result in results: title = result['title'] url = result['url'] print ( title + '; ' + url ) 438 2,110 0.965 115.32 (sidd_) 88.06 47.08 October 3, 2018
17. #10022 import std; int main() { std::println("Hello World!"); } 56 110 0.962 98.52fishy15 (fishy15) 45.38 43.17 November 20, 2023
18. #10004 this = (fsm_instance *)kmalloc(sizeof(fsm_instance), order); if (this == NULL) { printk(KERN_WARNING "fsm(%s): init_fsm: Couldn't alloc instance\n", name); return NULL; } memset(this, 0, sizeof(fsm_instance)); strlcpy(this->name, name, sizeof(this->name)); 256 4,335 0.934 132.63Sean Wrona (arenasnow) 88.97 45.29 December 5, 2009
19. #10007 (publish :path "/hello-count" :content-type "text/html" :function (let ((count 0)) #'(lambda (req ent) (with-http-response (req ent) (with-http-body (req ent) (html (:html (:head (:title "Hello Counter")) (:body ((:font :color (nth (random 5) '("red" "blue" "green" "purple" "black"))) "Hello World had been called " (:princ (incf count)) " times"))))))))) 356 3,013 0.932 109.35paradoxical (chaoschild) 85.06 48.05 November 19, 2009
20. #10003 int res; unsigned long flags; u32 data = 0; if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; spin_lock_irqsave(&pci_lock, flags); res = bus->ops->read(bus, devfn, pos, len, &data); *value = (type)data; spin_unlock_irqrestore(&pci_lock, flags); return res; 264 4,081 0.914 128.30chillin (slekap) 88.77 44.70 December 5, 2009
21. #10011 print("2 + 2 is {}, minus 1 that's {}. quick maths.".format(2 + 2, 2 + 2 - 1)) 78 2,751 0.913 119.54paradoxical (chaoschild) 85.01 41.98 December 29, 2017
22. #10008 (defop hello2 req (w/link (pr "there") (pr "here"))) (defop hello3 req (w/link (w/link (pr "end") (pr "middle")) (pr "start"))) (defop hello4 req (aform [w/link (pr "you said: " (arg _ "foo")) (pr "click here")] (input "foo") (submit))) 236 4,385 0.911 121.70Sean Wrona (arenasnow) 88.41 44.18 December 6, 2009
23. #10025 cmake_minimum_required(VERSION 3.10) project(Tutorial VERSION 1.0) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) # configure a header file to pass some of the CMake settings to the source code configure_file(TutorialConfig.h.in TutorialConfig.h) add_executable(Tutorial tutorial.cxx) # add the binary tree to the search path for include files so that we will find TutorialConfig.h target_include_directories(Tutorial PUBLIC "${PROJECT_BINARY_DIR}") 467 9 0.907 68.13Bijay (moneybijay) 55.17 55.17 December 6, 2023
24. #10013 if (response) { try { var dealData = JSON.parse(response); // Try to parse JSON showContent(dealData); // Show JSON data } catch(e) { var errorMessage = e.name + ' ' + e.message; // Create error msg console.log(errorMessage); // Show devs msg feed.innerHTML = '<em>Sorry, could not load deals</em>';// Show users msg } finally { var link = document.createElement('a'); // Add refresh link link.innerHTML = ' <a href="try-catch-finally.html">reload</a>'; feed.appendChild(link); } } 501 47 0.872 112.00 (sidd_) 64.28 64.28 October 3, 2018
25. #10023 auto monad = [](auto v) { return [=] { return v; }; }; auto bind = [](auto m) { return [=](auto fvm) { return fvm(m()); }; }; static_assert(bind(monad(2))(monad)() == monad(2)()); 179 44 0.859 56.79Jay (kamikamigod) 34.52 34.52 December 6, 2023
26. #10012 var $form, width, height, area; $form = $('#calculator'); $('#calculator').on('submit', function(e) { e.preventDefault(); console.log('Clicked submit...'); width = $('#width').val(); height = $('#height').val(); area = (width * height); if (area < 100) { debugger; // A breakpoint is set if the developer tools are open } $form.append('<p>' + area + '</p>'); }); 372 52 0.834 107.41 (sidd_) 62.56 62.56 October 2, 2018
27. #10026 NamedDecl *Sema::getCurFunctionOrMethodDecl() const { DeclContext *DC = getFunctionLevelDeclContext(); if (isa<ObjCMethodDecl>(DC) || isa<FunctionDecl>(DC)) return cast<NamedDecl>(DC); return nullptr; } 202 33 0.793 58.30Arrogant (dkaocka) 34.46 34.46 December 4, 2023
28. #10014 function showContent(dealData) { var newContent = ''; for (var i in dealData.deals) { newContent += '<div class="deal">'; newContent += '<h2>' + dealData.deals[i].title + '</h2>'; newContent += '<p>' + dealData.deals[i].description + '</p>'; newContent += '<a href="' + dealData.deals[i].link + '">'; newContent += ' ' + dealData.deals[i].link; newContent +='</a>'; newContent += '</div>'; } feed.innerHTML = newContent; } 440 30 0.712 90.78 (sidd_) 55.52 55.52 October 3, 2018