如何完成代码以输入为整数并输出一个“*”字符的正方形

How to complete the code to take the input as an integer and output a square of "*" characters

val = int(input())
for x in range (0, val):
    print('*',end='')

我想在

时得到答案输入是5
*****
*****
*****
*****
*****

如何做到这一点???

Python 有点奇怪,你实际上可以将你的字符串乘以一个数字,它会多次打印字符串。

val = int(input())
for x in range (0, val):
    print('*' * val)