d = {1: 10, 2: 20, 3: 30, 4: 40, 5: 50, 6: 60}  
def is_key_present(x):  
  if x in d:  
      print('Key is present in the dictionary')  
  else:  
      print('Key is not present in the dictionary')  
is_key_present(5)  
is_key_present(9)

 

相关文章:

  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2022-02-26
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
猜你喜欢
  • 2021-12-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2021-07-15
相关资源
相似解决方案