Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- A = [10, 20,.... 500]
- B = [1, 4,.... 2500]
- def func():
- x = input("enter a value from the array A: ") #user input
- for i in range(50):
- if A[i] == x:
- print(B[i])
- else:
- print("do nothing")
- func()
- A = [10, 20,.... 500]
- B = [1, 4,.... 2500]
- def func():
- x = int(input("enter a value from the array A: ")) #user input
- for i in range(50):
- if A[i] == x:
- print(B[i])
- else:
- print("do nothing")
- func()
- A = [10, 20,.... 500]
- B = [1, 4,.... 2500]
- def func():
- x = int(input("enter a value from the array A: ")) #user input
- for i,v in enumerate(A):
- if v == x:
- print(B[i])
- break
- else:
- print("do nothing")
- func()
- def func():
- x=int(input("enter a value from the array A: "))
- if x in A:
- idx = A.index(x)
- print(B[idx])
- else:
- print("do nothing")
Add Comment
Please, Sign In to add comment