Is there a way to make the print_str
function be more concise and becomes one line?
def print_str(str):
if len(str)>0:
print(str + ", "+ "hi")
else:
print("hi")
if __name__ == '__main__':
print_str(("John"))
print_str((""))
In java we can do something like
print(str + (str.equals("") ? "" : ", ") + "hi");