Menu Close

 Find the sequence of given integers in Python…fcukthecode.com

Sort the given set of integers using bubble sort and find the smallest and largest among given set of integers. 
Get the number of integers 
Receive the integers 
Sort the integers using bubble sort 
Print the start and end of sequence

INPUT:
Enter the Integers:  99  5  6  97

OUTPUT:
Sequence of integers:  4 to 100
Ele = list(map(int,input("Enter the Integers: ").split(" ")))
max = Ele[0]
min = Ele[0]

for i in range(len(Ele)):
    if Ele[i] > max:
        max = Ele[i]
    if Ele[i] < min:
        min = Ele[i]

print("Sequence of integers: " + str(min-1) + " to " + str(max+1))


INPUT_1:
Enter the Integers:   99  5  6  97

OUTPUT:
Sequence of integers:   4  to  100


INPUT_2:
Enter the Integers:   4  5  88  99  105  109

OUTPUT:
Sequence of integers:   3  to  110


INPUT_3:
Enter the Integers:   55  500  69  488  499  55  99

OUTPUT:
Sequence of integers:   54  to  501


INPUT_4:
Enter the Integers:   1  1  5  9  9  10  10

OUTPUT:
Sequence of integers:   0  to  11


ILLUSTRATION

Executed using python3