h=int(input("Enter height of triangle: ")) c=input("Enter character: ") #check for -ve h if h<=0: h=3 #check for c #remove whitespaces c=c.replace(" ","") #if c has no or multiple characters if c=="": c="*" if len(c)>1: c=c[0] #print triangle #if height is only 1 if h==1: print(c) else: s1=h-1 s2=0 for i in range(s1): print(end=" ") print(c) s1-=1 s2+=1 for i in range(2,h): for j in range(s1): print(end=" ") print(c,end="") for k in range(s2): print(end=" ") print(c,end="") s1-=1 s2+=2 print() print(c,end="") for i in range(s2): print(c,end="") print(c,end="") print("") How can I move the triangle to the right with this code? How canI fix it?
#take input
h=int(input("Enter height of triangle: "))
c=input("Enter character: ")
#check for -ve h
if h<=0:
h=3
#check for c
#remove whitespaces
c=c.replace(" ","")
#if c has no or multiple characters
if c=="":
c="*"
if len(c)>1:
c=c[0]
#print triangle
#if height is only 1
if h==1:
print(c)
else:
s1=h-1
s2=0
for i in range(s1):
print(end=" ")
print(c)
s1-=1
s2+=1
for i in range(2,h):
for j in range(s1):
print(end=" ")
print(c,end="")
for k in range(s2):
print(end=" ")
print(c,end="")
s1-=1
s2+=2
print()
print(c,end="")
for i in range(s2):
print(c,end="")
print(c,end="")
print("")
How can I move the triangle to the right with this code? How canI fix it?
![Enter height of triangle: 7
Character: *
* *
***
*****
+
* *
+
+
*
**
**
+
+
+](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fec2ae404-0619-4da1-b41d-2b12da835c13%2F7976bb17-d758-4a6e-bcb9-d9e0be47714d%2Fhnj8n0r_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)