How to take infinite input in Python | Example code

  • by

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

Simple example code takes any type of user enter value.

inputs = []
while True:
    inp = input("Type Anything/ Press Enter: ")
    if inp == "":



How to take infinite input in Python

Do comment if you have any doubts or suggestions on this Python input program.

Note: IDE: PyCharm 2021.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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.