I am trying to print names that equal to inputs
for example :
if input1 = 'A' and input2 = 'G'
print("Arsalan Ghasemi")
so my code works but for some names it's not working
if input = 'S' and second input = 'S' again it will print 3 names that has 'S' in it even they are lowercases
here my code
names = ['Arsalan Ghasemi', 'Ali Bahonar', 'Negin Soleimani', 'Farzaneh Talebi', 'Sina Ghahremani',
'Saman Sorayaie', 'Abtin Tavanmand', 'Masoud Jahani', 'Roya Pendar', 'Zeynab Arabi',
'Amirhossein Tajbakhsh', 'Aria Irani']
def names_with_input(input1, input2):
for i in range(len(names)):
if input1.upper() in names[i] and input2.upper() in names[i]:
print(names[i])
first = input('Enter first letter: ')
last = input('Enter last letter: ')
names_with_input(first, last)
I thought it's only check upper cases but seems it's not how I can fix this when inputs are 'S' and 'S', it should only give me 'Saman Sorayaie'