Answers for "else statement with for loop python"

1

python for/else

for n in range(2, 10):
    for x in range(2, n):
        if n % x == 0:
            print( n, 'equals', x, '*', n/x)
            break
    else:
        # loop fell through without finding a factor
        print(n, 'is a prime number')
Posted by: Guest on July-22-2021
0

if loop in python syntax

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

Code answers related to "else statement with for loop python"

Python Answers by Framework

Browse Popular Code Answers by Language