[Python] my program is not able to find if an element is part of a list

Discussão em 'Python' iniciado por Stack, Agosto 23, 2025.

  1. Stack

    Stack Membro Participativo

    squre = 1
    list = []
    while squre <= 10:
    list.append(squre * squre)
    squre += 1
    print(list)
    search = int(input("Enter a number to search : "))
    for i in list:

    if (i == search):
    print(f"{search} is in the square list")
    break
    else:
    print(f"{search}This is not in the list")
    break


    I want to match search with list, but can't succeed.

    Continue reading...

Compartilhe esta Página