from pathlib import Path
date = yes
my_path = Path(hello) / date if date else no / last
print(my_path)

The result will be:

hello/yes

Where is the last go? It goes with the no. The python interpreter will consider "no" / "last" under the else condition even it actually break the syntax rule. The correct way to write the ternary operator should be:

my_path = Path(hello) / (date if date else no) / last

Now the result become:

hello/yes/last