Skip to content

Commit

Permalink
feat: aggiunge una funzione che verifica se un numero è nell'array pr…
Browse files Browse the repository at this point in the history
…edefinito o meno
  • Loading branch information
Darakuu committed Oct 30, 2023
1 parent c446327 commit 03427c6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/verify.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
"""
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, array):
if number in array:
return True
else:
return False


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")

0 comments on commit 03427c6

Please sign in to comment.