我想在不使用任何数组的情况下打印第二个最小的数字,但这并不奏效。这是我目前所做的。
numbers = 5
print('Enter your numbers\n')
for x in range(0, numbers):
use = input('Enter #' + str(x + 1) + ': ')
if x == 0:
small = int(use)
second = small
if int(use) < small:
small = int(use)
if small > second:
second = int(use)
print('\nSecond smallest number is ' + str(second))