Question

                         Using Python 3.8 I have this function: Which prints this: But I need to use...

                        

Using Python 3.8

I have this function:

Which prints this:

But I need to use a for loop and a join with 3 or 4 spaces to have it print like this:

.    .    .    .    .

.    .    .    .    .

.    .    .    .    .

.    .    .    .    .

.    .    .    .    .

Homework Answers

Answer #1

Below is the python program to print .(dot) square of length 5 with 3 spaces between each dot - (change the length variable from 5 to any number and function name is pattern, change it as per your need) (attached the ouput image after the code)

def pattern():
    length = 5
    for i in range(length):
        for i in range(length):
            print('.', end = '   ')
        print()
pattern();

Output image :

Code image :

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Write a Python program using while loop that finds and prints the sum of this geometric...
Write a Python program using while loop that finds and prints the sum of this geometric series. 1 + 2 +4 +8 + … + 1024
Q1) Write a Python function partial_print, which takes one parameter, a string, and prints the first,...
Q1) Write a Python function partial_print, which takes one parameter, a string, and prints the first, third, fifth (and so on) characters of the strings, with each character both preceded and followed by the ^ symbol, and with a newline appearing after the last ^ symbol. The function returns no value; its goal is to print its output, but not to return it. Q2) Write a Python function called lines_of_code that takes a Path object as a parameter, which is...
python code Write the function definition for a function which accepts one value from the main...
python code Write the function definition for a function which accepts one value from the main program and prints three times the number that is sent to it. For example, if the program sent 8, the function would print 24.
Write a Python program using that takes a number as input and then prints if the...
Write a Python program using that takes a number as input and then prints if the number is even or odd. The program should use a function isEven that takes a number as a parameter and returns a logical value true if the number is even, false otherwise.
Write a program in python reverse each and every word of the sentence using function taking...
Write a program in python reverse each and every word of the sentence using function taking string as input parameter from user and passing that string into function and also explain the logic ======================================= input: 'Exam is gonna be good' output: 'maxE si annog eb doog' ================ i am trying like this but getting confused '.'join([w::-1] for w in s.split()]) i need more focus on explanations because it is making me confuse i am not clear with concepts so please...
PLEASE HURRY, will upvote if correct python Write a method that prints characters using the following...
PLEASE HURRY, will upvote if correct python Write a method that prints characters using the following header: def printChars(ch1,ch2): this function prints out the characters between ch1 and ch2 inclusive. Assumption is that ch2 is always bigger than c1 and both lower cases. also Write a function that accepts a list as an argument and prints the number of occurrence of each item def itemOccurence(myList): i.e. input ("Hello",123, 342, 123, "Hello",123) output: 2 times "Hello" 3 times 123 1 time...
Using Python Assigns the value of “dog” to the variable AnimalName. Assigns the value of “pigeon”...
Using Python Assigns the value of “dog” to the variable AnimalName. Assigns the value of “pigeon” to the variable AltAnimal. Includes an if-statement in which… (Hint: You should use both elif and else.) If the value of AnimalName is “cat”, prints “The animal is a cat.” Includes a comment on the same line as this if-statement that explains what the if-statement is looking for (i.e., what would have to be true for the statement to return “true”). If the value...
Python Language ONLY! Python Language ONLY! Python Language ONLY! When doing this try to use a...
Python Language ONLY! Python Language ONLY! Python Language ONLY! When doing this try to use a level one skill python, like as if you just learned this don't use anything advanced if you can please. Write a for loop (only one for loop) that computes the total of the following series of numbers: (20/1)+(19/2)+(18/3)+(17/4)+.....+(1/20)
Python. create a function that takes a string as a parameter and prints out the following...
Python. create a function that takes a string as a parameter and prints out the following details as the example output below. If the string is "Hello, my name is Starling, Clarice. My, my, my, nice to meet you." The output would be: Unique words: 10 Number of commas: 5 Number of periods: 2 Number of sentences: 2 (HINT: Use the following string methods: split, lower, count, replace, format, and use the following functions: set, len. You may need to...
Python Code Use (for loops) inside another for loop (a nested loop) to do the following:...
Python Code Use (for loops) inside another for loop (a nested loop) to do the following: Print Hello 30 times followed by Bye 10 times. Do that whole thing 15 times. (for a total of 600 lines of output) #Hint: First write the code that prints 30 "Hello" and then 10 "Bye". Think of that as two separate tasks, each of which requires its own for loop. THEN, once you get that working, put all of that inside ANOTHER loop...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT