CPTTRN2 - Character Patterns (Act 2)

来源:互联网 发布:js访问对象 编辑:程序博客网 时间:2024/06/04 23:36

Using two characters: . (dot) and * (asterisk) print a frame-like pattern.

Input

You are given t - the number of test cases and for each of the test cases two positive integers: l - the number of lines and c - the number of columns of a frame.

Output

For each of the test cases output the requested pattern (please have a look at the example). Use one line break in between successive patterns.

Example

Input:33 14 42 5Output:********..**..***************
主要 是python中的if语句的使用

代码如下

t = int(input())for i in range(t):    line = input()    l = int(line.split(' ')[0])    c = int(line.split(' ')[1])    for j in range(l):        for k in range(c):            if j == 0 or j == l - 1:                print('*', sep='', end='')            elif k == 0 or k == c - 1:                print('*', sep='', end='')            else:                print('.', sep='',end='')        print()    



0 0
原创粉丝点击