-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c446327
commit 4c44f89
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# 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. | ||
|
||
def isPresent(N: list, n: int) -> bool: | ||
return n in N | ||
|
||
def main(): | ||
n = int(input("Insert number: ")) | ||
N = [3, 4, 5, 1, 2, 3, 4, 9, 13, 0] | ||
if isPresent(N, n): print(f"The number {n} is present in the array.") | ||
else: print(f"The number {n} is not present in the array.") | ||
|
||
if __name__ == "__main__": | ||
main() |