en
Feedback
O Level Previous paper

O Level Previous paper

Open in Telegram

https://youtube.com/@Satya806 सभी लोग इस Channel को Subscribe कर लो https://t.me/O_levelpaper Telegram group Quiz 👉https://t.me/o_levelsatya #M4-R5_Paper #M2R5 #O_Level #M3R5_Notes #M1R5Video #PaidClass_O_Level #O_Level_Notes #Satya_Sir

Show more
732
Subscribers
No data24 hours
-17 days
-130 days
Posts Archive
Computer shortcut
Computer shortcut

# Python program to calculate the area of a triangle with base and height base = float(input("Enter the base length of the triangle: ")) height = float(input("Enter the height of the triangle: ")) area = 0.5 * base * height print("The area of the triangle is:", area)

# Python program to find area of an equilateral triangle import math side = float(input("Enter the side length of the equilateral triangle: ")) # Calculate the area of the equilateral triangle area = (math.sqrt(3) / 4) * side ** 2 print("The area of the equilateral triangle is:", area)

# Find Area of Triangle With Python Lambda calculate_area = lambda base, height: 0.5 * base * height # Taking input from the user base = float(input("Enter the base length of the triangle: ")) height = float(input("Enter the height of the triangle: ")) # Calculating the area of the triangle using the lambda function area = calculate_area(base, height) print("The area of the triangle is:", area)

print_multiplication_table = lambda number, rows=10: [print(f"{number} x {i} = {number * i}") for i in range(1, rows + 1)] # Example usage num = int(input("Enter a number: ")) print_multiplication_table(num)

# How to print multiplication table in Python using while loop and function def multiplication_table(n): i = 1 while i <= n: j = 1 while j <= n: print(i * j, end='\t') j += 1 print() i += 1 # Test the program number = int(input("Enter a number: ")) multiplication_table(number)

Enter a number: 5 Multiplication table of 5: 5 x 1 = 5 5 x 2 = 10 5 x 3 = 15 5 x 4 = 20 5 x 5 = 25 5 x 6 = 30 5 x 7 = 35 5 x 8 = 40 5 x 9 = 45 5 x 10 = 50

# Printing table in Python for given number using for loop and function def print_multiplication_table(number): print(f"Multiplication table of {number}:") for i in range(1, 11): result = number * i print(f"{number} x {i} = {result}") # Example usage num = int(input("Enter a number: ")) print_multiplication_table(num)

Enter a character: A The ASCII value of A is 65

# Prompt the user to enter a character character = input("Enter a character: ") # Get the ASCII value using the ord() function ascii_value = ord(character) # Print the ASCII value print("The ASCII value of", character, "is", ascii_value)

# Square root program in Python import math # Take input from the user num = float(input("Enter a number: ")) # Calculate the square root sqrt = math.sqrt(num) # Print the result print("The square root of", num, "is", sqrt)

Original Matrix: [[1 2 3] [4 5 6] [7 8 9]] Transpose Matrix: [[1 4 7] [2 5 8] [3 6 9]]

Find Transpose of Matrix in Python (Program to Inverse Matrix)

दोनों प्रोग्राम में बस थोड़ा सा अंतर होता है np.dot - Multiplication ✖️ np.add - Add +

import numpy as np # Example matrices matrix1 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) matrix2 = np.array([[9, 8, 7], [6, 5, 4], [3, 2, 1]]) # Add the matrices using numpy.add() result_matrix = np.add(matrix1, matrix2) # Print the result matrix print(result_matrix)

Result Matrix: [[ 84 90 96] [201 216 231] [318 342 366]]

Matrix Multiplication in Python Using NumPy

# How to find prime numbers in Python using while loop def is_prime(number): if number <= 1: return False i = 2 while i < number: if number % i == 0: return False i += 1 return True # Example usage num = int(input("Enter a number: ")) if is_prime(num): print(num, "is a prime number.") else: print(num, "is not a prime number.")

# Python program to check prime number with user input def is_prime(number): if number <= 1: return False for i in range(2, int(number ** 0.5) + 1): if number % i == 0: return False return True # Prompt the user to enter a number num = int(input("Enter a number: ")) if is_prime(num): print(num, "is a prime number.") else: print(num, "is not a prime number.")

Note- प्रश्न में अगर कोई भी कंडीशन नहीं देता है तो आप इनमें से कोई भी प्रोग्राम कर सकते हैं Ex- Find GCD 👆