Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: aggiunge una funzione che verifica se un numero è nell'array predefinito o meno #146

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
Write a software that verifies if a number is present in a pre-defined array.

Output example:
Insert number 3
The number 3 is [not] present in the array.
"""

numbers = [1, 2, 3, 12, 89, 69, 133, 56, 99, 100000]


def look_for_number(number: int, array: list[int]) -> bool:
return number in array


wantedInt = int(input("Scegli un numero da cercare nell'array: "))

if look_for_number(wantedInt, numbers):
print(f"{wantedInt} is in the array")
else:
print(f"{wantedInt} is not in the array")
Loading