Mar-25-2022, 11:57 AM
The problem:
Input = My name is Bob and this is my wife Alice.
Output = Hello Bob and Alice!
else
Input = My name is Bob.
Output = Hello Bob!
else
Input = My name is Bob.
Output = Hello Bob!
What i came up with:
I feel like i am close
Would love if someone had the time to do the full code, its easier for me to understand then getting an explanation
Input = My name is Bob and this is my wife Alice.
Output = Hello Bob and Alice!
else
Input = My name is Bob.
Output = Hello Bob!
else
Input = My name is Bob.
Output = Hello Bob!
What i came up with:
name = (input()) for name in name.split(): if name == ('Bob') and ('Alice'): print ('Hello Bob & Alice!') elif name == ('Alice'): print ('Hello Alice!') elif name == ('Bob'): print ('Hello Bob!')I tried the >>> in operator but the problem is that it says its true if input was (Bobdylan)
I feel like i am close
Would love if someone had the time to do the full code, its easier for me to understand then getting an explanation