Character Rhombus in Python

Character rhombus in python is one such great python program that almost all computer Teacher use to teach concept of looping and string manipulation.

This simple yet powerful script was shared by Raju Vashishtha Sir from Deep Memorial Public School. Here is the python script to print character rhombus.

# purpose       : program to print char rhombus
# made by       : Raju Vashistha
# License       : MIT

""" Receive a string from user """
nm=input("Your String is here ...")
""" Steps to print first part of rombus"""
for i in range(0,len(nm)):
   for j in range(len(nm)-i,0,-1):
        print(" ",end=" ")
   for k in range(0,i+1):
        print(nm[k]," ",end=" ")

""" steps to print bottom of rhombus"""

for i in range(0,len(nm)):
    for j in range(-2,i):
        print(" ",end=" ")
    for k in range(0,len(nm)-i-1):
        print(nm[k]," ",end=" ")

The program was written in visual studio code in Windows 10. The program will not work properly in sublime Text and Atom IDE as both are not able to receive input from user and send that input back to your program.

Suggested reading : Top 5 Python IDE for students

Here is the output of character Rhombus programĀ  written in Python.


If you also have any such interesting program and want to share with community. Please do not hesitate to contact us.

Leave a Reply