Guest User

Untitled

a guest
Sep 25th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. A = [10, 20,.... 500]
  2. B = [1, 4,.... 2500]
  3.  
  4. def func():
  5. x = input("enter a value from the array A: ") #user input
  6. for i in range(50):
  7. if A[i] == x:
  8. print(B[i])
  9.  
  10. else:
  11. print("do nothing")
  12.  
  13. func()
  14.  
  15. A = [10, 20,.... 500]
  16. B = [1, 4,.... 2500]
  17.  
  18. def func():
  19. x = int(input("enter a value from the array A: ")) #user input
  20. for i in range(50):
  21. if A[i] == x:
  22. print(B[i])
  23.  
  24. else:
  25. print("do nothing")
  26.  
  27. func()
  28.  
  29. A = [10, 20,.... 500]
  30. B = [1, 4,.... 2500]
  31.  
  32. def func():
  33. x = int(input("enter a value from the array A: ")) #user input
  34. for i,v in enumerate(A):
  35. if v == x:
  36. print(B[i])
  37. break
  38.  
  39. else:
  40. print("do nothing")
  41.  
  42. func()
  43.  
  44. def func():
  45. x=int(input("enter a value from the array A: "))
  46. if x in A:
  47. idx = A.index(x)
  48. print(B[idx])
  49. else:
  50. print("do nothing")
Add Comment
Please, Sign In to add comment