Answers for "python for loop if else"

4

python for else

list = [99, 98, 97, 96, 95, 94]

for number in list:
  if number == 2:
    print("There is a 2 in the list")
  	break
else:
  print("There are no 2's in the list")
  
# The else statement is only reached if the for loop
# has run all the way through without breaking
Posted by: Guest on May-18-2020
1

if else python

if condition:
   result
elif condition:
   result
else:
   result
Posted by: Guest on January-11-2021
0

if loop in python syntax

if a>b :
  print(a)
Posted by: Guest on May-09-2021

Code answers related to "python for loop if else"

Python Answers by Framework

Browse Popular Code Answers by Language