So I've got a string called "correct_body", which is either: "Large narrow body,,£7,5600,220,10" or "Medium wide body,,£5,4050,406,14" or "Medium narrow body,,£8,2650,180,8. And I've got a list called, "max_distance" containing these numbers: ['5600', '4050', '2650'] I want to be able to compare the list with the string and if one of the list's number is in the string I'd like it to be printed. Here's my code:
for x in max_distance:
if x in correct_body:
distance = x
print(distance)
So if the string is "Large narrow body,,£7,5600,220,10" then 5600 should be printed.