Creating a square page
Write a program that receives a number and prints the figure below:
Write a program that receives a number and prints the figure below:
number = int(input("Enter number : ")) for x in range(number) : print("--- " * number) number2 = number + 1 print("| " * number2)
n = int(input("chand?"))
for i in range (n) :
print (str("--- ") * n)
print (str("| ") * (n+1))
print (str("--- ") * n)
x = int(input('vared kon ada mored nazar ro :'))
for i in range(x):
print('--- ' * x)
print((x+1) *'| ')
print('--- ' * x)
number = int(input("please enter a number: ")) for i in range(0, number): print("--- --- ---") print("| | | |")
def print_pattern(n): # Printing above each square for _ in range(n): print('---', end=' ') print() # The new line # The middle printing of each square for _ in range(n): print('| ', end=' ') print() # The new line # Printing down each square for _ in range(n): print('---', end=' ') print() # The new line # Get a number from the user number = int(input("یک عدد وارد کنید: ")) print_pattern(number)
def print_shape(n): # Printing above each box for _ in range(n): print("---", end=" ") print() # The new line # Printing the body of each box for _ in range(n): print("| ", end="") print("|") # The new line # Printing down each box for _ in range(n): print("---", end=" ") print() # The new line # Get input from the user try: user_input = int(input("لطفاً یک عدد وارد کنید: ")) if user_input < 1: print("لطفاً عددی بزرگتر از صفر وارد کنید.") else: for _ in range(user_input): print_shape(user_input) except ValueError: print("لطفاً یک عدد صحیح وارد کنید.")
num_of_rows = int(input("Please enter number of rows: ")) a = "--- --- ---" b = "| | | |" print(a) for i in range (num_of_rows): print(b) print(a)
def adad(): num = int(input("enter your number:")) a = 0 for i in range(a,num): print("--- --- ---") print("/ / / /") adad()
The second method
Submitting answers is currently unavailable.
Write a program that has a graphical environment and can perform the sum, subtraction, multiplication and division operations on the infinite number. (Exactly like a real calculator)
Write a function that receives some and checks whether the amount received is the email. If the email was True, otherwise the False return the email should contain @ before @ should be a phrase as a work name ...
Write a program that receives the square area from the user and prints the size of each side in the output
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.