your_name = input("Please tell me your name: ")
your_age = int(input("Please tell me your age: "))
print_times = int(input("How many times would you like to print this message? "))
years_old = 2023 + 100 - your_age
print(("Hi ", your_name + " ", "you will be 100 years old in ", years_old) * print_times)
而不是
print(("Hi ", your_name + " ", "you will be 100 years old in ", years_old) * print_times)
您可以使用更具可读性的 f 字符串与 ' ' 分隔输出:
print(f'Hi, {your_name}, you will be 100 years old in {years_old} \n' * print_times)