How do i make this pattern from user input using a for loop (i want my code to be able to produce the output on the bottom)

python nub
Size = int(input("what is the size of the box "))

def Stars(Size):
  for x in range(0, Size):
    for y in range(0, Size):
      print("*",end="")
Stars()
OUTPUT (if the size of the box was 4)
        ****
        *==*
        *==*
        ****
Mohammad

for the first and last line, they should be outside the loop. Then you can create the loop normally,

def stars(x):
    print('*'*x)
    for i in range(1,x-1):
        print('*'+'='*(x-2)+'*')
    print('*'*x)

stars(4)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How do I make my code NOT display a recent input?

How do I make my code loop back to the beginning in Java?

How do I input data from a CSV file into my code?

How do I edit my code so that I may output the frequency of TWO specific characters input by a user? (C Language)

How do I use recursion to loop my code (when user enters invalid input, it prompts them again)?

How can I reduce the below code? I do not want to put the 'for loop' and want to accept input as a list of integers

how do I make my player collide with the bottom of my platform

How do I make a loop for user input in python?

How do I make my image "grow" from the bottom up using Jquery animate?

How do I output my audio input?

How do I make my nextLine() wait for the user's input?

How to do with that if I want to pass the data from the input, and also want user can not edit the id input?

How do I use the user input to write the output using Tkinter?

How do I make a rectangle with user input?

How do i output a user input string

How can I make my code respond to user input

How do I make the code of python which get the input data from a text file with using input()?

i want to make my javascript code optimize using arrays and loop(for loop)

i want to save the responses i get from users through my code so how do i do that

How can I make sure my code continues to loop while only accepting integer values from the user input?

How do I validate user input in a loop?

I want my Assembly Code to takes user input and outputs it along with other text but the output isn't correct

How can I make the "do" loop continue, but not infinitely in my code?

How can I amend my code related to loops to produce the expected output using java?

I want to use User input from PySimpleGUI to one of my output Excel file name

How do I make my code loop the function fight()

how do i make the user input a double?

How do I make my code printf increment from 0 every loop?

How can I make sure user input must be the same input I need from my array