How To Write a program in Python that asks user to input 5 lines of numbers. Your program should represent these lines as a table.

Write a program in Python that asks user to input 5 lines of numbers. Your program should represent these lines as a table.


#function that checks if n is float or not
def float_or_not(n):
    for char in n:
        if char == ".":
            return True

table = []

for i in range(5):
    numbers = input("Enter some numbers: ").split(" ")
    for x, y in enumerate(numbers):
        if float_or_not(y) == True:
            numbers[x] = float(y)
        else:
            numbers[x] = int(y)
    table.append(numbers)

print(table)


Learn More :