Python Forum
#python .... Need to develop a if condition from two lists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
#python .... Need to develop a if condition from two lists
#1
I need to solve a problem could anyone help me with the same. Below is the detailed description of my problem
I have two list , lets says
list1=['a1','b1','c1']  
list2 = ['a2','b2,'c2']
I
I need to develop a if condition using these two list with 'and' and 'or' condition just like below :
if((data1 =='a1' and data2=='a2') or (data1 == 'b1' and data2=='b2') or (data1 =='c1' and data2=='c2')):
 print("success")
else:
 print("failed")
Could you help me with how to form the same without hardcoding the values
Reply


Messages In This Thread
#python .... Need to develop a if condition from two lists - by ginu - Oct-04-2018, 06:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Advice on develop an offline audio transcription software with no knowledge woah 3 1,343 Jan-05-2023, 05:02 PM
Last Post: Larz60+
  Develop neural network for consumption function vaibhavpwr101 0 728 Oct-03-2022, 05:29 AM
Last Post: vaibhavpwr101

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020