+ 2
How do I print the following on Python?
Suppose I made a list : [āappleā , āorangeā , āpear , ākiwiā] And I went through a filtering process in a for loop Which filtered āappleā and ākiwiā out. I would like the result to be: apple and kiwi chosen But i donāt know how to add the āandā between two items from the list and printing them individually, with the āchosenā at the end. Plus, the result would be diferrent everytime e.g if only orange is chosen, itāll print: orange chosen Thanks!
1 Answer
+ 6
Why not select Apple and Kiwi into a new list called k?
Then, you can do:
print(*k, sep=" and ", end="chosen.")