使用 random.randrange() 在 Python 中生成随机数。生成最终数字后,将创建一个“%”。我怎样才能解决这个问题?

Generating random numbers in Python using random.randrange(). After the final number is generated, a "%" is created. How can I fix this?

import random

# Main menu.
print('**** Welcome to the Pick-3, Pick-4 lottery number generator! ****\n\
    \nSelect from the following menu:\n\n1. Generate 3-Digit Lottery number\
    \n2. Generate 4-Digit Lottery number\n3. Exit the Application\n')

# Holds the user's selection in memory.
userInput = int(input())

# If-else statements performs proper operation for the user.
if userInput == 1:
    print('\nYou selected 1. The following 3-digit lottery number was generated:\
        \n\n')
    for i in range(3):
        print(random.randrange(1, 10), end = '')

if userInput == 2:
    print('\nYou selected 2. The following 4-digit lottery number was generated:\
        \n\n')
    for i in range(4):
        print(random.randrange(1, 10), end = '')

if userInput == 3:
    print('\nYou selected 3.\n\nThanks for trying the Lottery Application.\
        \n\n*********************************************************')
    SystemExit

这是我输入 1 时得到的输出,例如:

您选择了1。生成了以下3位开奖号码:

657%

我怎样才能去掉这个百分号?我正在使用 VSCode 进行编译。谢谢

% 不是从 Python 输出的。这是你的 shell 告诉你没有尾随的换行符(或者更确切地说,光标留在非零列偏移处;你的 shell 看不到程序的输出 运行 在未捕获或重定向输出时写入,但它可以查询终端的光标位置)。退出前的最后一次打印不应该有 end=''.