Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

do while python

# do while sample loop in python
# do statements in try while number is < 0
i = 0
number = -1
while number < 0:
    try:
        number = int(input("Enter a number: "))
        print(number)
        i += 1
    except ValueError:
        print("Invalid input")
Source by www.py4e.com #
 
PREVIOUS NEXT
Tagged: #python
ADD COMMENT
Topic
Name
8+4 =