{"id":22996,"date":"2021-12-09T11:45:10","date_gmt":"2021-12-09T06:15:10","guid":{"rendered":"https:\/\/tutorial.eyehunts.com\/?p=22996"},"modified":"2023-07-21T17:36:41","modified_gmt":"2023-07-21T12:06:41","slug":"how-to-keep-asking-for-user-input-python-example-code","status":"publish","type":"post","link":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/","title":{"rendered":"How to keep asking for user input Python | Example code"},"content":{"rendered":"\n<p>There are two ways to keep asking for user input in Python. First using <a href=\"https:\/\/tutorial.eyehunts.com\/python\/while-true-python-while-loop-is-bad-break-out\/\">while true<\/a> with<a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-boolean-if-statement-example-codes\/\"> if statement<\/a> and <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-for-break-statement-example-code\/\">break statement<\/a>. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:             # Loop continuously\n    inp = input()       # Get the input\n    if inp == \"\":       # If it is a blank line...\n        break           # ...break the loop\n<\/code><\/pre>\n\n\n\n<p>Another way is using a <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-while-loop-user-input-example-code\/\">while loop<\/a> with <a href=\"https:\/\/tutorial.eyehunts.com\/python\/python-conditional-expression-basics\/\">condition expression<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>inp = input()       # Get the input\nwhile inp != \"\":        # Loop until it is a blank line\n    inp = raw_input()   # Get the input again<\/code><\/pre>\n\n\n\n<p><strong>Note: <\/strong>this code supports Python 3.x, you will need to use raw_input for the below versions.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example keep asking for user input in Python<\/strong><\/h2>\n\n\n\n<p>A simple example code continues asking the user for input until it is considered valid.<\/p>\n\n\n\n<p><strong>Example 1<\/strong><\/p>\n\n\n\n<p>Input is taken as a string by default.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pw = '123'\n\nwhile True:\n\n    number = input(\"Enter the Password: \")\n\n    if number == pw:\n        print(\"GOT IT\")\n        break\n    else:\n        print(\"Wrong try again\")\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"382\" height=\"182\" src=\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg?resize=382%2C182&#038;ssl=1\" alt=\"How to keep asking for user input Python\" class=\"wp-image-23076\"\/><\/figure><\/div>\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>Example 2<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>number = \"\"\n\nwhile number != '123':\n    number = input(\"Enter the Password: \")\n<\/code><\/pre>\n\n\n\n<p><strong>Output<\/strong>:<\/p>\n\n\n\n<p>Enter the Password: 1<br>Enter the Password: 123<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Another common way to do this is by using a <code>while<\/code> loop. Here&#8217;s an example of how to keep asking for user input in Python:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\r\n    user_input = input(\"Enter something (or 'exit' to quit): \")\r\n\r\n    if user_input.lower() == 'exit':\r\n        print(\"Exiting...\")\r\n        break\r\n\r\n    # Do something with the user input\r\n    print(\"You entered:\", user_input)\r\n\r\n# Code will continue here after the loop\r\nprint(\"End of the program.\")\r<\/code><\/pre>\n\n\n\n<p>In this example, the <code>while True:<\/code> creates an infinite loop because the condition is always true. Inside the loop, we use the <code>input()<\/code> function to get user input, and then we check if the input is equal to &#8220;exit&#8221; (case-insensitive) using <code>user_input.lower() == 'exit'<\/code>. If the user enters &#8220;exit&#8221;, the program prints a message and breaks out of the loop using the <code>break<\/code> statement. Otherwise, it processes the user input, and the loop continues to ask for more input.<\/p>\n\n\n\n<p>To stop the program and break out of the loop, the user can simply type &#8220;exit&#8221;. Otherwise, the loop will keep running and asking for input until the user decides to quit.<\/p>\n\n\n\n<div style=\"height:30px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Do comment if you have any doubts or suggestions on this Python input program.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p><strong>Note:<\/strong> IDE:&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/pycharm\/\" target=\"_blank\">PyCharm<\/a>&nbsp;2021.3.3 (Community Edition)<\/p><p>Windows 10<\/p><p><strong>Python 3.10.1<\/strong><\/p><p>All<strong>&nbsp;Python Examples&nbsp;are in&nbsp;Python&nbsp;3<\/strong>, so Maybe its different from python 2 or upgraded versions.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>There are two ways to keep asking for user input in Python. First using while true with if statement and break statement. Another way is using a while loop with condition expression. Note: this code supports Python 3.x, you will need to use raw_input for the below versions. Example keep asking for user input in&hellip;&nbsp;<a href=\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">How to keep asking for user input Python | Example code<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[30],"tags":[136,263],"post_series":[],"class_list":["post-22996","post","type-post","status-publish","format-standard","hentry","category-python","tag-python-code","tag-python-input"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.1.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to keep asking for user input Python | Example code<\/title>\n<meta name=\"description\" content=\"There are two ways to do keep asking for user input in Python. First using while true with if statement and break statement.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to keep asking for user input Python | Example code\" \/>\n<meta property=\"og:description\" content=\"There are two ways to do keep asking for user input in Python. First using while true with if statement and break statement.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-09T06:15:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-21T12:06:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg\" \/>\n<meta name=\"author\" content=\"Rohit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rohit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/\",\"name\":\"How to keep asking for user input Python | Example code\",\"isPartOf\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg\",\"datePublished\":\"2021-12-09T06:15:10+00:00\",\"dateModified\":\"2023-07-21T12:06:41+00:00\",\"author\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\"},\"description\":\"There are two ways to do keep asking for user input in Python. First using while true with if statement and break statement.\",\"breadcrumb\":{\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg?fit=382%2C182&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg?fit=382%2C182&ssl=1\",\"width\":382,\"height\":182},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/tutorial.eyehunts.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to keep asking for user input Python | Example code\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#website\",\"url\":\"https:\/\/tutorial.eyehunts.com\/\",\"name\":\"Tutorial\",\"description\":\"By EyeHunts\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1\",\"name\":\"Rohit\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777979855\",\"contentUrl\":\"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777979855\",\"caption\":\"Rohit\"},\"description\":\"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.\",\"url\":\"https:\/\/tutorial.eyehunts.com\/author\/rohit\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to keep asking for user input Python | Example code","description":"There are two ways to do keep asking for user input in Python. First using while true with if statement and break statement.","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:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/","og_locale":"en_US","og_type":"article","og_title":"How to keep asking for user input Python | Example code","og_description":"There are two ways to do keep asking for user input in Python. First using while true with if statement and break statement.","og_url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/","og_site_name":"Tutorial","article_published_time":"2021-12-09T06:15:10+00:00","article_modified_time":"2023-07-21T12:06:41+00:00","og_image":[{"url":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg","type":"","width":"","height":""}],"author":"Rohit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rohit","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/","url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/","name":"How to keep asking for user input Python | Example code","isPartOf":{"@id":"https:\/\/tutorial.eyehunts.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#primaryimage"},"image":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#primaryimage"},"thumbnailUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg","datePublished":"2021-12-09T06:15:10+00:00","dateModified":"2023-07-21T12:06:41+00:00","author":{"@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1"},"description":"There are two ways to do keep asking for user input in Python. First using while true with if statement and break statement.","breadcrumb":{"@id":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#primaryimage","url":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg?fit=382%2C182&ssl=1","contentUrl":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-keep-asking-for-user-input-Python.jpg?fit=382%2C182&ssl=1","width":382,"height":182},{"@type":"BreadcrumbList","@id":"https:\/\/tutorial.eyehunts.com\/python\/how-to-keep-asking-for-user-input-python-example-code\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/tutorial.eyehunts.com\/"},{"@type":"ListItem","position":2,"name":"How to keep asking for user input Python | Example code"}]},{"@type":"WebSite","@id":"https:\/\/tutorial.eyehunts.com\/#website","url":"https:\/\/tutorial.eyehunts.com\/","name":"Tutorial","description":"By EyeHunts","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/tutorial.eyehunts.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/69ca2cb8c13fdce0ee5b39d6175119b1","name":"Rohit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/tutorial.eyehunts.com\/#\/schema\/person\/image\/","url":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777979855","contentUrl":"https:\/\/tutorial.eyehunts.com\/wp-content\/litespeed\/avatar\/2b27529b86d6dfb5336897e07c93a827.jpg?ver=1777979855","caption":"Rohit"},"description":"Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology &amp; like learning technical.","url":"https:\/\/tutorial.eyehunts.com\/author\/rohit\/"}]}},"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":23079,"url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-take-continuous-input-in-python-example-code\/","url_meta":{"origin":22996,"position":0},"title":"How to take continuous input in Python | Example code","author":"Rohit","date":"December 14, 2021","format":false,"excerpt":"Use While loop with True condition expression to take continuous input in Python. And break the loop using if statement and break statement. while True: some_method() Example take continuous input in Python Simple example code gets user input repeatedly until want to quit. while True: user_input = input(\"Enter something: \")\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"How to take continuous input in Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-take-continuous-input-in-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":23017,"url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-take-infinite-input-in-python-example-code\/","url_meta":{"origin":22996,"position":1},"title":"How to take infinite input in Python | Example code","author":"Rohit","date":"December 8, 2021","format":false,"excerpt":"Use a while loop to take infinite input in Python. Save that input to the other data structure such a list and use any condition to break the while loop. Example take infinite input in Python A simple example code takes any type of user to enter a value. inputs\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"How to take infinite input in Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-take-infinite-input-in-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":23026,"url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-take-an-unknown-number-of-inputs-in-python-example-code\/","url_meta":{"origin":22996,"position":2},"title":"How to take an unknown number of inputs in Python | Example code","author":"Rohit","date":"December 13, 2021","format":false,"excerpt":"Use While True with if statement and break statement to take an unknown number of inputs in Python. Break the while when the user just hit enter without any input value. Example take an unknown number of inputs in Python Simple example code takes unknown numbers of inputs and stores\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"How to take an unknown number of inputs in Python","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/How-to-take-an-unknown-number-of-inputs-in-Python.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":22592,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-input-number-example-code\/","url_meta":{"origin":22996,"position":3},"title":"Python input number | Example code","author":"Rohit","date":"November 24, 2021","format":false,"excerpt":"To take input as a number in Python, Simply use the input() function to get input from the user and convert it into a number type. Convert input number example in Python A simple example code is the input() function parses user input as a string even if it contains\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python input number","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/11\/Python-input-number.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":22584,"url":"https:\/\/tutorial.eyehunts.com\/python\/how-to-take-space-separated-integer-input-in-python-3-example-code\/","url_meta":{"origin":22996,"position":4},"title":"How to take space-separated integer input in Python 3 | Example code","author":"Rohit","date":"November 22, 2021","format":false,"excerpt":"Use input(), map(), and split() functions to take space-separated integer input in Python 3. You have to use list() to convert the map to a list. list(map(int,input().split())) Where: input() accepts a string from STDIN. split() splits the string about the whitespace character and returns a list of strings. map() passes\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"How to take space-separated integer input in Python 3","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/11\/How-to-take-space-separated-integer-input-in-Python-3.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":22990,"url":"https:\/\/tutorial.eyehunts.com\/python\/python-exit-while-loop-with-user-input-example-code\/","url_meta":{"origin":22996,"position":5},"title":"Python exit while loop with user input | Example code","author":"Rohit","date":"December 9, 2021","format":false,"excerpt":"The while statement has a conditional expression, and the user enters the String. Just need to use user input in the while statement conditional and evaluate it. If false then Python exits while loop with user input. Example exit while loop with user input in Python Simple example code. flag\u2026","rel":"","context":"In &quot;Python&quot;","block_context":{"text":"Python","link":"https:\/\/tutorial.eyehunts.com\/category\/python\/"},"img":{"alt_text":"Python exit while loop with user input","src":"https:\/\/i0.wp.com\/tutorial.eyehunts.com\/wp-content\/uploads\/2021\/12\/Python-exit-while-loop-with-user-input.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/22996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/comments?post=22996"}],"version-history":[{"count":1,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/22996\/revisions"}],"predecessor-version":[{"id":41210,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/posts\/22996\/revisions\/41210"}],"wp:attachment":[{"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/media?parent=22996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/categories?post=22996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/tags?post=22996"},{"taxonomy":"post_series","embeddable":true,"href":"https:\/\/tutorial.eyehunts.com\/wp-json\/wp\/v2\/post_series?post=22996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}