# Prgram 1 Basic Calculator with User Input
def cal():
a = int(input("Enter the first number: "))
b = int(input("Enter the second number: "))
print("\nSimple Calculator Results:")
print(f"Addition: {a + b}")
print(f"Subtraction: {a - b}")
print(f"Multiplication: {a * b}")
cal()
# Prgram 2-- Pattern 1: Number Triangle
# Number Triangle Pattern with User-defined Rows
rows = int(input("Enter the number of rows for the
triangle pattern: "))
for i in range(1, rows + 1):
for j in range(1, i + 1):
print(j, end=" ")
print()
# Prgram 3 Right-Aligned Number Triangle
# Right-Aligned Number Triangle
for i in range(1, rows + 1):
print(" " * (rows - i) + " ".join(str(j) for j in
range(1, i + 1)))
# Prgram 4--String Manipulation and
Diamond Pattern
# Vowel Count in a User-entered Sentence
def count_vowels():
sentence = input("Enter a sentence: ")
vowels = 'aeiouAEIOU'
count = sum(1 for char in sentence if char in
vowels)
print(f"The sentence '{sentence}' contains
{count} vowels.")
count_vowels()
# Prgram 5 -- Diamond Pattern
# Diamond Pattern with User-defined Rows
rows = int(input("Enter the number of rows for the
diamond pattern: "))
for i in range(rows):
print(" " * (rows - i - 1) + "* " * (i + 1))
for i in range(rows - 1, 0, -1):
print(" " * (rows - i) + "* " * i)
# Prgram 6-- Star Pyramid Pattern
print("\n--- Star Pyramid Pattern ---")
# Star Pyramid Pattern with Nested Loops
rows = int(input("Enter the number of rows for the
pyramid pattern: "))
for i in range(1, rows + 1):
print(" " * (rows - i) + "* " * i)