Topic: Print ABA Alphabet Pyramid Python Program Pattern No. 12
The Source Code of Print ABA Alphabet Pyramid
How this Python Program works?
The first for loop is for the total number of lines or rows to be printed
The second for loop will print the required number of spaces.
The third for loop prints the first half party of the alphabetic pyramid.
The fourth for loop will print the remaining half alphabets pyramid.
What is the Use of chr() function and ord() function in Python
chr() function in Python
The chr() function in Python takes an integer Ascii code and returns the character (actually a string of one character)at that Ascii code value. For example , chr(65) will return ‘A’ and chr(97) will give ‘a’.
Note that the argument must be in the range [0..255], inclusive; Otherwise, ValueError will be raised if i is outside that range.
ord() function in Python
ord() function takes a string of length one (single character) as an argument and returns an integer representing the Unicode code point of that character when the argument is a unicode object, or the value of the byte when the argument is an 8-bit string. For example, ord(‘A’) gives 65 and ord(‘a’) returns the integer 97.
Python 3 Programs for 11 Alphabets Patterns, Pyramids, Triangles,Squares, Shapes
14,677 total views, 26 views today