{"id":1237,"date":"2020-12-03T14:53:01","date_gmt":"2020-12-03T14:53:01","guid":{"rendered":"http:\/\/learnlearn.uk\/python\/?page_id=1237"},"modified":"2020-12-03T15:12:25","modified_gmt":"2020-12-03T15:12:25","slug":"python-typewriter-code","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/","title":{"rendered":"Python Typewriter Code"},"content":{"rendered":"<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">Video<\/h2>\n<div class=\"tabcontent\">\n\n<p>In this tutorial we show you how you can add animated typewriter style code to your Python console projects to make them look cool \ud83d\ude42<\/p>\n<p>&nbsp;<\/p>\n<div class=\"nv-iframe-embed\">\n<div class=\"container-lazyload preview-lazyload container-youtube js-lazyload--not-loaded\"><a href=\"https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0\" class=\"lazy-load-youtube preview-lazyload preview-youtube\" data-video-title=\"Python  - Typewriter Style Animated Text Tutorial\" title=\"Play video &quot;Python  - Typewriter Style Animated Text Tutorial&quot;\">https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0<\/a><noscript>Video can&#8217;t be loaded because JavaScript is disabled: <a href=\"https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0\" title=\"Python  - Typewriter Style Animated Text Tutorial\">Python  &#8211; Typewriter Style Animated Text Tutorial (https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0)<\/a><\/noscript><\/div>\n<\/div>\n<p>&nbsp;<\/p>\n\n<\/div><h2 class=\"tabtitle\">Example Code<\/h2>\n<div class=\"tabcontent\">\n\n<h3><strong>Example Code<\/strong><\/h3>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">import<\/span> <span style=\"color: #0e84b5; font-weight: bold;\">sys<\/span><span style=\"color: #333333;\">,<\/span><span style=\"color: #0e84b5; font-weight: bold;\">time<\/span>\r\n\r\nmessage <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"please enter your name: \"<\/span>\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">def<\/span> <span style=\"color: #0066bb; font-weight: bold;\">typewriter<\/span>(message):\r\n    <span style=\"color: #008800; font-weight: bold;\">for<\/span> char <span style=\"color: #000000; font-weight: bold;\">in<\/span> message:\r\n        sys<span style=\"color: #333333;\">.<\/span>stdout<span style=\"color: #333333;\">.<\/span>write(char)\r\n        sys<span style=\"color: #333333;\">.<\/span>stdout<span style=\"color: #333333;\">.<\/span>flush()\r\n        \r\n        <span style=\"color: #008800; font-weight: bold;\">if<\/span> char <span style=\"color: #333333;\">!=<\/span>  <span style=\"background-color: #fff0f0;\">\"<\/span><span style=\"color: #666666; font-weight: bold; background-color: #fff0f0;\">\\n<\/span><span style=\"background-color: #fff0f0;\">\"<\/span>:\r\n            time<span style=\"color: #333333;\">.<\/span>sleep(<span style=\"color: #6600ee; font-weight: bold;\">0.1<\/span>)\r\n        <span style=\"color: #008800; font-weight: bold;\">else<\/span>:\r\n            time<span style=\"color: #333333;\">.<\/span>sleep(<span style=\"color: #0000dd; font-weight: bold;\">1<\/span>)\r\n\r\n\r\n<span style=\"color: #008800; font-weight: bold;\">def<\/span> <span style=\"color: #0066bb; font-weight: bold;\">type_input<\/span>(message):\r\n    <span style=\"color: #008800; font-weight: bold;\">for<\/span> char <span style=\"color: #000000; font-weight: bold;\">in<\/span> message:\r\n        sys<span style=\"color: #333333;\">.<\/span>stdout<span style=\"color: #333333;\">.<\/span>write(char)\r\n        sys<span style=\"color: #333333;\">.<\/span>stdout<span style=\"color: #333333;\">.<\/span>flush()\r\n        time<span style=\"color: #333333;\">.<\/span>sleep(<span style=\"color: #6600ee; font-weight: bold;\">0.1<\/span>)\r\n    <span style=\"color: #008800; font-weight: bold;\">return<\/span> <span style=\"color: #007020;\">input<\/span>()\r\n        \r\nname <span style=\"color: #333333;\">=<\/span> type_input(message)\r\n\r\ntypewriter(<span style=\"background-color: #fff0f0;\">\"nice to meet you \"<\/span> <span style=\"color: #333333;\">+<\/span> name)\r\n<\/pre>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial we show you how you can add animated typewriter style code to your Python console projects to make them look cool \ud83d\ude42 &nbsp; https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0Video can&#8217;t be loaded because JavaScript is disabled: Python &#8211; Typewriter Style Animated Text Tutorial (https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0) &nbsp; Example Code import sys,time message = &#8220;please enter your name: &#8221; def&hellip;&nbsp;<a href=\"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Python Typewriter Code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":70,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Typewriter Code - Python<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Typewriter Code - Python\" \/>\n<meta property=\"og:description\" content=\"In this tutorial we show you how you can add animated typewriter style code to your Python console projects to make them look cool \ud83d\ude42 &nbsp; https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0Video can&#8217;t be loaded because JavaScript is disabled: Python &#8211; Typewriter Style Animated Text Tutorial (https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0) &nbsp; Example Code import sys,time message = &quot;please enter your name: &quot; def&hellip;&nbsp;Read More &raquo;Python Typewriter Code\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Python\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-03T15:12:25+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/\",\"url\":\"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/\",\"name\":\"Python Typewriter Code - Python\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#website\"},\"datePublished\":\"2020-12-03T14:53:01+00:00\",\"dateModified\":\"2020-12-03T15:12:25+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Python Unit Home\",\"item\":\"https:\/\/learnlearn.uk\/python\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Typewriter Code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#website\",\"url\":\"https:\/\/learnlearn.uk\/python\/\",\"name\":\"Python\",\"description\":\"Programming\",\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/python\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#organization\",\"name\":\"Python\",\"url\":\"https:\/\/learnlearn.uk\/python\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/python\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2019\/03\/LearnLearnLogowhite.png\",\"contentUrl\":\"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2019\/03\/LearnLearnLogowhite.png\",\"width\":710,\"height\":98,\"caption\":\"Python\"},\"image\":{\"@id\":\"https:\/\/learnlearn.uk\/python\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Typewriter Code - Python","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/","og_locale":"en_GB","og_type":"article","og_title":"Python Typewriter Code - Python","og_description":"In this tutorial we show you how you can add animated typewriter style code to your Python console projects to make them look cool \ud83d\ude42 &nbsp; https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0Video can&#8217;t be loaded because JavaScript is disabled: Python &#8211; Typewriter Style Animated Text Tutorial (https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0) &nbsp; Example Code import sys,time message = \"please enter your name: \" def&hellip;&nbsp;Read More &raquo;Python Typewriter Code","og_url":"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/","og_site_name":"Python","article_modified_time":"2020-12-03T15:12:25+00:00","twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/","url":"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/","name":"Python Typewriter Code - Python","isPartOf":{"@id":"https:\/\/learnlearn.uk\/python\/#website"},"datePublished":"2020-12-03T14:53:01+00:00","dateModified":"2020-12-03T15:12:25+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/python\/python-typewriter-code\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/python\/python-typewriter-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Python Unit Home","item":"https:\/\/learnlearn.uk\/python\/"},{"@type":"ListItem","position":2,"name":"Python Typewriter Code"}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/python\/#website","url":"https:\/\/learnlearn.uk\/python\/","name":"Python","description":"Programming","publisher":{"@id":"https:\/\/learnlearn.uk\/python\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/python\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/learnlearn.uk\/python\/#organization","name":"Python","url":"https:\/\/learnlearn.uk\/python\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/python\/#\/schema\/logo\/image\/","url":"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2019\/03\/LearnLearnLogowhite.png","contentUrl":"https:\/\/learnlearn.uk\/python\/wp-content\/uploads\/sites\/4\/2019\/03\/LearnLearnLogowhite.png","width":710,"height":98,"caption":"Python"},"image":{"@id":"https:\/\/learnlearn.uk\/python\/#\/schema\/logo\/image\/"}}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/python\/author\/learnlearnadmin\/"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"In this tutorial we show you how you can add animated typewriter style code to your Python console projects to make them look cool \ud83d\ude42 &nbsp; https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0Video can&#8217;t be loaded because JavaScript is disabled: Python &#8211; Typewriter Style Animated Text Tutorial (https:\/\/www.youtube.com\/watch?v=2h8e0tXHfk0) &nbsp; Example Code import sys,time message = \"please enter your name: \" def&hellip;&nbsp;Read&hellip;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/pages\/1237"}],"collection":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/comments?post=1237"}],"version-history":[{"count":3,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/pages\/1237\/revisions"}],"predecessor-version":[{"id":1242,"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/pages\/1237\/revisions\/1242"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/python\/wp-json\/wp\/v2\/media?parent=1237"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}