Skip to content

Instantly share code, notes, and snippets.

@RaMSFT
Created October 14, 2022 10:24
Show Gist options
  • Select an option

  • Save RaMSFT/51f7924fa752491765badd06e61513f8 to your computer and use it in GitHub Desktop.

Select an option

Save RaMSFT/51f7924fa752491765badd06e61513f8 to your computer and use it in GitHub Desktop.
def check_number_in_list(lst, num):
if num in lst:
result = f"{num} exist in the list"
else:
result = f"{num} doesn't exist in the list"
return result
print(check_number_in_list([1, 2, 3, 4, 5], 3) )
print(check_number_in_list([1, 1, 2, 1, 1], 3) )
print(check_number_in_list([5, 5, 5, 6], 5) )
print(check_number_in_list([], 5) )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment