展开全部
# -*- coding: utf-8 -*-
#py 3
n=2
while n<5 or n>15:#检查输入合法性
print('Please enter a number from 5 to 15:')
n=int(input())
m=2
while m<5 or m>15:#检查输入合法性
print('Please enter a number from 5 to 15 (again):')
m=int(input())
for i in range(n):#输出结果
for j in range(m):
if i==0 or i==n-1 or j==0 or j==m-1:#只打印边框
print ('*',end='')
else:
print(' ',end='')#边框内输出空白
print('') #断行
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
#-*-coding:utf-8-*-
n = int(input("Please enter a number from 5 to 15:"))
m = int(input("Please enter a number from 5 to 15(again):"))
if 5 <= n <= 15 and 5 <= m <= 15:
for i in range(n):
tmp = ""
for j in range(m):
if i==0 or j==0 or i==n-1 or j==m-1:
tmp += "*"
else:
tmp += " "
tmp += "\n"
print(tmp)
else:
print("输入的数字有误")
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询