Learn how to print half pyramids using “Alphabet”. Write a program using “for” loop. Get the integer value as input and print half pyramid using alphabet as output.
Num=int(input("Enter an integer: ")) char=65 for i in range(Num): for j in range(i+1): print(chr(char)+" ",end="")#using end, you can print in the same line without any new line character. char+=1 print()
Input:
Enter an integer: 5
Output:
A
B B
C C C
D D D D
E E E E E
Scrshot
More Codes to Fcuk
- Alphabet pyramid
- Find prime numbers between lower and upper ranges
- Prime Factor
- Find the sum of positive even numbers
- An integer interval [a,b], Find the minimum size of a set S.
- Country A and B, how many years the population of A surpasses B.
- Identify pH level
- Find the Perfect Number
- Find out if a word is a palindrome or not
- Find next Palindrome of N number.
- The writing bot Question. A scientist has created a writing bot. Read and write activity needs to be captured.
- Total Number of Odds in the list
- Partition this string into as many parts as possible.
- Leap year
- LCM of two numbers
- Greatest of three numbers
- Find the Gravitational Force Acting Between Two Objects.
- Find the missing element in geometric progression
- Find the GCD Greatest common divisor
- convert a given float number to integer