Write a program in python to draw the following figure what


Exercises

1. Given a string and a non-negative int n, return a larger string that is n copies of the original string.

Examples:
string_times('Hi', 2) → 'HiHi'
string_times('Hi', 3) → 'HiHiHi'
string_times('Hi', 1) → 'Hi'

What is the complexity in asymptotic notation of your solution?

2. Write a program in Python to draw the following figure:

1627_Figure.jpg

What is the complexity in asymptotic notation of your solution?

Exercises

3. Return the "centered" average of an array of ints, which we'll say is the mean average of the values, except ignoring the largest and smallest values in the array. If there are multiple copies of the smallest value, ignore just one copy, and likewise for the largest value. Use int division to produce the final average. You may assume that the array is length 3 or more.

centered_average([1, 2, 3, 4, 100]) → 3
centered_average([l, 1, 5, 5, 10, 8, 7]) → 5
centered_average([-10, -4, -2, -4, -2, 0]) → 3

4. Write a program in Python to draw the following figure:

2022_Figure_Design.jpg

What is the complexity in asymptotic notation of your solution?

5. Write a program in Python to draw the following figure:

581_Triangle.jpg

What is the complexity in asymptotic notation of your solution?

6. Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz"
yields 3, since the "xx", "aa", and "az" substrings appear in the same place in both strings.

string match('xxcaazz', 'xxbaaz') → 3
string match('abc', 'abc') → 2
string match('abc', 'axc') → 0

What is the complexity in asymptotic notation of your solution?

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Write a program in python to draw the following figure what
Reference No:- TGS01661089

Expected delivery within 24 Hours