tutorial.eyehunts.com
Open in
urlscan Pro
194.163.47.62
Public Scan
URL:
https://tutorial.eyehunts.com/python/python-exit-while-loop-with-user-input-example-code/
Submission: On February 16 via api from US — Scanned from DE
Submission: On February 16 via api from US — Scanned from DE
Form analysis
6 forms found in the DOMGET https://tutorial.eyehunts.com/
<form role="search" method="get" class="search-form" action="https://tutorial.eyehunts.com/">
<label>
<span class="screen-reader-text">Search for...</span>
</label>
<input type="search" class="search-field" aria-label="Search" placeholder="Search for..." value="" name="s">
<button type="submit" class="search-submit nv-submit" aria-label="Search">
<span class="nv-search-icon-wrap">
<span class="nv-icon nv-search">
<svg width="15" height="15" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path
d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z">
</path>
</svg>
</span></span>
</button>
</form>
GET https://tutorial.eyehunts.com/
<form role="search" method="get" class="search-form" action="https://tutorial.eyehunts.com/">
<label>
<span class="screen-reader-text">Search for...</span>
</label>
<input type="search" class="search-field" aria-label="Search" placeholder="Search for..." value="" name="s">
<button type="submit" class="search-submit nv-submit" aria-label="Search">
<span class="nv-search-icon-wrap">
<span class="nv-icon nv-search">
<svg width="15" height="15" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path
d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z">
</path>
</svg>
</span></span>
</button>
</form>
POST https://tutorial.eyehunts.com/wp-comments-post.php
<form action="https://tutorial.eyehunts.com/wp-comments-post.php" method="post" id="commentform" class="comment-form">
<p class="comment-notes"><span id="email-notes">Your email address will not be published.</span> <span class="required-field-message">Required fields are marked <span class="required">*</span></span></p>
<p class="comment-form-author"><label for="author">Name <span class="required">*</span></label> <input id="author" name="author" type="text" value="" size="30" maxlength="245" autocomplete="name" required="required"></p>
<p class="comment-form-email"><label for="email">Email <span class="required">*</span></label> <input id="email" name="email" type="text" value="" size="30" maxlength="100" aria-describedby="email-notes" autocomplete="email" required="required">
</p>
<p class="comment-form-url"><label for="url">Website</label> <input id="url" name="url" type="text" value="" size="30" maxlength="200" autocomplete="url"></p>
<p class="comment-form-comment"><label for="comment">Comment <span class="required">*</span></label> <textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea></p>
<p class="comment-subscription-form"><input type="checkbox" name="subscribe_comments" id="subscribe_comments" value="subscribe" style="width: auto; -moz-appearance: checkbox; -webkit-appearance: checkbox;"> <label class="subscribe-label"
id="subscribe-label" for="subscribe_comments">Notify me of follow-up comments by email.</label></p>
<p class="comment-subscription-form"><input type="checkbox" name="subscribe_blog" id="subscribe_blog" value="subscribe" style="width: auto; -moz-appearance: checkbox; -webkit-appearance: checkbox;"> <label class="subscribe-label"
id="subscribe-blog-label" for="subscribe_blog">Notify me of new posts by email.</label></p>
<p class="form-submit"><input name="submit" type="submit" id="submit" class="button button-primary" value="Post Comment"> <input type="hidden" name="comment_post_ID" value="22990" id="comment_post_ID">
<input type="hidden" name="comment_parent" id="comment_parent" value="0">
</p>
<p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="95ad623bb7"></p>
<p style="display: none !important;"><label>Δ<textarea name="ak_hp_textarea" cols="45" rows="8" maxlength="100"></textarea></label><input type="hidden" id="ak_js_1" name="ak_js" value="1676520524930"></p>
</form>
GET https://tutorial.eyehunts.com/
<form role="search" method="get" class="search-form" action="https://tutorial.eyehunts.com/">
<label>
<span class="screen-reader-text">Search for...</span>
</label>
<input type="search" class="search-field" aria-label="Search" placeholder="Search for..." value="" name="s">
<button type="submit" class="search-submit nv-submit" aria-label="Search">
<span class="nv-search-icon-wrap">
<span class="nv-icon nv-search">
<svg width="15" height="15" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg">
<path
d="M1216 832q0-185-131.5-316.5t-316.5-131.5-316.5 131.5-131.5 316.5 131.5 316.5 316.5 131.5 316.5-131.5 131.5-316.5zm512 832q0 52-38 90t-90 38q-54 0-90-38l-343-342q-179 124-399 124-143 0-273.5-55.5t-225-150-150-225-55.5-273.5 55.5-273.5 150-225 225-150 273.5-55.5 273.5 55.5 225 150 150 225 55.5 273.5q0 220-124 399l343 343q37 37 37 90z">
</path>
</svg>
</span></span>
</button>
</form>
POST #
<form action="#" method="post" accept-charset="utf-8" id="subscribe-blog-blog_subscription-4" data-blog="104175811" data-post_access_level="everybody">
<p id="subscribe-email">
<label id="jetpack-subscribe-label" class="screen-reader-text" for="subscribe-field-blog_subscription-4"> Email Address </label>
<input type="email" name="email" required="required" value="" id="subscribe-field-blog_subscription-4" placeholder="Email Address">
</p>
<p id="subscribe-submit">
<input type="hidden" name="action" value="subscribe">
<input type="hidden" name="source" value="https://tutorial.eyehunts.com/python/python-exit-while-loop-with-user-input-example-code/">
<input type="hidden" name="sub-type" value="widget">
<input type="hidden" name="redirect_fragment" value="subscribe-blog-blog_subscription-4">
<button type="submit" class="wp-block-button__link" name="jetpack_subscriptions_widget"> Subscribe </button>
</p>
</form>
<form id="jp-carousel-comment-form">
<label for="jp-carousel-comment-form-comment-field" class="screen-reader-text">Write a Comment...</label>
<textarea name="comment" class="jp-carousel-comment-form-field jp-carousel-comment-form-textarea" id="jp-carousel-comment-form-comment-field" placeholder="Write a Comment..."></textarea>
<div id="jp-carousel-comment-form-submit-and-info-wrapper">
<div id="jp-carousel-comment-form-commenting-as">
<fieldset>
<label for="jp-carousel-comment-form-email-field">Email (Required)</label>
<input type="text" name="email" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-email-field">
</fieldset>
<fieldset>
<label for="jp-carousel-comment-form-author-field">Name (Required)</label>
<input type="text" name="author" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-author-field">
</fieldset>
<fieldset>
<label for="jp-carousel-comment-form-url-field">Website</label>
<input type="text" name="url" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-url-field">
</fieldset>
</div>
<input type="submit" name="submit" class="jp-carousel-comment-form-button" id="jp-carousel-comment-form-button-submit" value="Post Comment">
</div>
</form>
Text Content
Skip to content Tutorial By EyeHunts Search for... * EyeHunts.com * Java * Python * Android * Tutorial * Andriod * JAVA * Python * Contact US * Training Tutorial By EyeHunts Search for... Navigation Menu Navigation Menu * EyeHunts.com * Java * Python * Android * Tutorial * Andriod * JAVA * Python * Contact US * Training PYTHON EXIT WHILE LOOP WITH USER INPUT | EXAMPLE CODE * by Rohit * December 9, 2021December 9, 2021 The while statement has 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 = "1" while flag != "0": print("Not broken") flag = input("to break loop enter '0': ") Output: Another example Add the movie entered to a list. Continue asking for a movie until the user enters ‘0’. After all, movies have been input, output the list of movies one movie per line. Use the break keyword to interrupt either a while or a for-loop. def addMovie(): movies = [] while True: movie = input("Enter the name of a movie: ") if movie == "0": break else: movies.append(movie) print("That's your list") print(movies) addMovie() Output: Enter the name of a movie: AAA Enter the name of a movie: BBB Enter the name of a movie: 0 That’s your list [‘AAA’, ‘BBB’] Source: stackoverflow.com Do comment if you have any doubts or suggestions on this Python input function. > Note: IDE: PyCharm 2021.3.3 (Community Edition) > > Windows 10 > > Python 3.10.1 > > All Python Examples are in Python 3, so Maybe its different from python 2 or > upgraded versions. Rohit Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical. SHARE THIS: * Facebook * WhatsApp * LinkedIn * More * * Twitter * Print * * Reddit * Tumblr * * Pinterest * Pocket * * Telegram * Skype * * Email * RELATED HOW TO TAKE MULTIPLE INPUTS IN PYTHON USING WHILE LOOP | EXAMPLE CODE Use While True to take multiple inputs in Python using a while loop. Don't forget to break the loop based on input. Example take multiple inputs in Python using while loop Simple example codes Multiple Inputs with Python using While Loop. Exit the loop if the user enters "stop". while… PYTHON WHILE LOOP USER INPUT | EXAMPLE CODE You can create a while with user input-based value evaluation with conditions. Just need to take input from the user and evaluate those values in the while loop expression condition. Example while loop user input in Python Simple example code takes input from the user and adds values into a… PYTHON WHILE LOOP INPUT VALIDATION | EXAMPLE CODE Data validation is important when the user input it. It makes sure it is valid before it is used in a computation. You can do Input Validation with While Loops in Python. Example while loop input validation in Python Simple example code While loop with List calculates BMI in Python.… Tags:Python exitPython inputPython LoopsPython While LEAVE A REPLY CANCEL REPLY Your email address will not be published. Required fields are marked * Name * Email * Website Comment * Notify me of follow-up comments by email. Notify me of new posts by email. Δ This site uses Akismet to reduce spam. Learn how your comment data is processed. Search Topics Search for... Recent Posts * Is not numeric Python * Python any lambda * Python any() function * Python check if string contains substring from list * isnumeric() Python String function Categories * Android * Android Interview Questions * Android Kotlin * Android UI * C * CSS * Data structure * HTML * Info * Java * JavaScript * Kotlin * Material Design * Memes * Python * SQL * Tool * TypeScript Archives Archives Select Month February 2023 January 2023 December 2022 November 2022 October 2022 September 2022 August 2022 July 2022 June 2022 May 2022 April 2022 March 2022 February 2022 January 2022 December 2021 November 2021 October 2021 September 2021 August 2021 July 2021 June 2021 May 2021 April 2021 March 2021 February 2021 January 2021 December 2020 November 2020 October 2020 September 2020 August 2020 July 2020 June 2020 May 2020 April 2020 March 2020 February 2020 January 2020 December 2019 November 2019 October 2019 September 2019 August 2019 July 2019 June 2019 May 2019 April 2019 March 2019 February 2019 January 2019 December 2018 November 2018 October 2018 September 2018 August 2018 July 2018 June 2018 May 2018 September 2016 August 2016 April 2016 March 2016 December 2015 Subscribe Email Address Subscribe Copyright © 2014 EyeHunts.com. All Rights Reserved Neve | Powered by WordPress Loading Comments... Write a Comment... Email (Required) Name (Required) Website