Python Program to pattern of Letter C

Hello everyone! Welcome back to programminginpython.com, here in this post I am going to show you how to print a pattern of Letter C.

This is a continuation of the letter pattern printing series, in the previous tutorials I have explained the patterns of Letter A and Letter B.

Master the basics of data analysis in Python. Expand your skillset by learning scientific computing with numpy.

Take the course on Introduction to Python on DataCamp here https://bit.ly/datacamp-intro-to-python

Program on Github

You can also watch the video on YouTube here.

Task:

Python program to print the pattern of letter ‘C’

Approach:

  • Read an input integer for asking the sizeof the letter using  input()
  • Check if the entered number is greater than 8,
    • if yes, call the function print_pattern()
    • else, show a message to enter a number which is greater or equal to 8
  • print_pattern()
    • here we only do two things, print star(*) and print space( ), just writing conditions so the pattern of *‘s and ‘s will display the pattern ‘C’
    • following are 3 conditions for printing *’s
      We have 2 loops, outer loop() for rows and inner loop for columns.

        1. the first line of alphabet
        2. last line
        3. first column
    • print   in remaining all cases.

Program:

Output:

Letter C - Pattern Programming - programminginpython.com
Letter C – Pattern Programming – programminginpython.com
Letter C - Pattern Programming - programminginpython.com
Letter C – Pattern Programming – programminginpython.com

Print pattern C – Code Visualization

Course Suggestion

Machine Learning everywhere! So I strongly suggest you to take the course below.
Course: Machine Learning Adv: Support Vector Machines (SVM) Python

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.