Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Python function called printHashtags that expects one argument, a non-n

ID: 3858352 • Letter: C

Question

Create a Python function called printHashtags that expects one argument, a non-negative integer, and prints a row of hashtags, where the number of hashtags is given by the value passed as the argument. Control the printing with a while loop, not with a construct that looks like print("#" * n). This function does not return any value. Here are some examples of how your function should behave: > > > printHashtags (1) # > > > printHashtags (2) ## printHashtags (3) ### > > > printHashtags (4) #### > > > printHashtags(0) > > > Create a Python-function called printTriangle that expects one argument, a non-negative integer, and prints a right triangle, where both the height of the triangle and the width of the widest part of the triangle are given by the value passed as the argument. This function does not return any value. Your function should use your solution to Problem 3 in printing the triangle. Here are some examples of how your function should behave: > > > printTriangle (4) #### ### ## # > > > printTriangle (3) ### ## # > > > printTriangle (2)

Explanation / Answer

Problem3:

def printHashtags(n): #defining the function
count=0
while(count<n): #looping the n no.of times
print('#',end="")
count=count+1

num=eval(input("Enter input number:"))
printHashtags(num)

PROBLEM 4:

def printHashtags(n): #defining the function
count=0
while(count<n): #looping the n no.of times
print('#',end="")
count=count+1

def printTriangle(m): #defining Triangle function
while(m>0): #looping from m to 1
printHashtags(m) #using hash tags function to print each line in triangle
print()
m=m-1

num=eval(input("Enter input number:"))
printTriangle(num)