pythonCopy codeprint("Hello, World!")
 
  ಬಳಕೆದಾರ ಇನ್‌ಪುಟ್: ಈ ಪ್ರೋಗ್ರಾಂ ಮೌಲ್ಯವನ್ನು ನಮೂದಿಸಲು ಬಳಕೆದಾರರನ್ನು ಪ್ರೇರೇಪಿಸುತ್ತದೆ ಮತ್ತು ನಂತರ ಮೌಲ್ಯವನ್ನು ಕನ್ಸೋಲ್‌ಗೆ ಮುದ್ರಿಸುತ್ತದೆ. 

pythonCopy codevalue = input("Enter a value: ")
print("You entered:", value)

 ಸರಳ ಲೆಕ್ಕಾಚಾರ: ಈ ಪ್ರೋಗ್ರಾಂ ಎರಡು ಸಂಖ್ಯೆಗಳ ಮೊತ್ತವನ್ನು ಲೆಕ್ಕಾಚಾರ ಮಾಡುತ್ತದೆ ಮತ್ತು ಫಲಿತಾಂಶವನ್ನು ಕನ್ಸೋಲ್‌ಗೆ ಮುದ್ರಿಸುತ್ತದೆ.
pythonCopy codenum1 = 5
num2 = 7
sum = num1 + num2
print("The sum is:", sum)
ಷರತ್ತುಬದ್ಧ ಹೇಳಿಕೆ: ಈ ಪ್ರೋಗ್ರಾಂ ಸಂಖ್ಯೆ 10 ಕ್ಕಿಂತ ಹೆಚ್ಚಿದೆಯೇ ಎಂದು ಪರಿಶೀಲಿಸುತ್ತದೆ ಮತ್ತು ಫಲಿತಾಂಶದ ಆಧಾರದ ಮೇಲೆ ಸಂದೇಶವನ್ನು ಮುದ್ರಿಸುತ್ತದೆ.
  
pythonCopy codenum = 12
if num > 10:
    print("The number is greater than 10")
else:
    print("The number is less than or equal to 10")

 ಲೂಪ್‌ಗಾಗಿ: ಈ ಪ್ರೋಗ್ರಾಂ ಸಂಖ್ಯೆಗಳ ಪಟ್ಟಿಯನ್ನು ಪುನರಾವರ್ತಿಸಲು ಫಾರ್ ಲೂಪ್ ಅನ್ನು ಬಳಸುತ್ತದೆ ಮತ್ತು ಪ್ರತಿ ಸಂಖ್ಯೆಯನ್ನು ಕನ್ಸೋಲ್‌ಗೆ ಮುದ್ರಿಸುತ್ತದೆ.
pythonCopy codenumbers = [1, 2, 3, 4, 5]
for num in numbers:
    print(num)
 ಲೂಪ್ ಮಾಡುವಾಗ: ಈ ಪ್ರೋಗ್ರಾಂ 1 ರಿಂದ 5 ರವರೆಗಿನ ಸಂಖ್ಯೆಗಳನ್ನು ಕನ್ಸೋಲ್‌ಗೆ ಮುದ್ರಿಸಲು ಸ್ವಲ್ಪ ಸಮಯದ ಲೂಪ್ ಅನ್ನು ಬಳಸುತ್ತದೆ.
pythonCopy codei = 1
while i <= 5:
    print(i)
    i += 1
ಪಟ್ಟಿ ಕಾಂಪ್ರಹೆನ್ಷನ್: ಈ ಪ್ರೋಗ್ರಾಂ ವರ್ಗ ಸಂಖ್ಯೆಗಳ ಪಟ್ಟಿಯನ್ನು ರಚಿಸಲು ಪಟ್ಟಿ ಕಾಂಪ್ರಹೆನ್ಷನ್ ಅನ್ನು ಬಳಸುತ್ತದೆ.
 
pythonCopy codenumbers = [1, 2, 3, 4, 5]
squares = [num**2 for num in numbers]
print(squares)

  ಕಾರ್ಯ: ಈ ಪ್ರೋಗ್ರಾಂ ವೃತ್ತದ ಪ್ರದೇಶವನ್ನು ಲೆಕ್ಕಾಚಾರ ಮಾಡುವ ಕಾರ್ಯವನ್ನು ವ್ಯಾಖ್ಯಾನಿಸುತ್ತದೆ.
pythonCopy codedef area_of_circle(radius):
    pi = 3.14
    area = pi * radius**2
    return area

print("The area of a circle with radius 5 is:", area_of_circle(5))

  
ನಿಘಂಟು: ಈ ಪ್ರೋಗ್ರಾಂ ಹೆಸರುಗಳು ಮತ್ತು ವಯಸ್ಸಿನ ನಿಘಂಟನ್ನು ರಚಿಸುತ್ತದೆ ಮತ್ತು "J" ನೊಂದಿಗೆ ಪ್ರಾರಂಭವಾಗುವ ಜನರ ವಯಸ್ಸನ್ನು ಮುದ್ರಿಸುತ್ತದೆ.
pythonCopy codeages = {"John": 25, "Jane": 30, "Mark": 28, "Jenny": 27}
for name, age in ages.items():
    if name.startswith("J"):
        print(name, "is", age, "years old")
ಫೈಲ್ ನಿರ್ವಹಣೆ: ಈ ಪ್ರೋಗ್ರಾಂ ಪಠ್ಯ ಫೈಲ್ ಅನ್ನು ಓದುತ್ತದೆ, ಪ್ರತಿ ಪದದ ಸಂಭವಿಸುವಿಕೆಯ ಸಂಖ್ಯೆಯನ್ನು ಎಣಿಕೆ ಮಾಡುತ್ತದೆ ಮತ್ತು ಫಲಿತಾಂಶಗಳನ್ನು ಕನ್ಸೋಲ್‌ಗೆ ಮುದ್ರಿಸುತ್ತದೆ.  
pythonCopy codewith open("example.txt", "r") as file:
    words = file.read().split()
    word_count = {}
    for word in words:
        if word in word_count:
            word_count[word] += 1
        else:
            word_count[word] = 1
    for word, count in word_count.items():
        print(word, ":", count)
  1. Hello, World! program print(“Hello, World!”)
  2. Getting user input name = input(“What is your name? “)
  3. Printing variables x = 5 print(“The value of x is”, x)
  4. Adding two numbers a = 5 b = 10 c = a + b print(c)
  5. For loop for i in range(5): print(i)
  6. While loop i = 0 while i < 5: print(i) i += 1
  7. If statement x = 5 if x < 10: print(“x is less than 10”)
  8. List my_list = [1, 2, 3, 4, 5]
  9. Dictionary my_dict = {‘name’: ‘John’, ‘age’: 25}
  10. Tuple my_tuple = (1, 2, 3)
  11. Set my_set = {1, 2, 3}
  12. Adding items to a list my_list.append(6)
  13. Removing items from a list my_list.remove(3)
  14. Using a function def my_function(x): return x + 1
  15. Using a class class MyClass: def init(self, x): self.x = x
  16. Reading a file with open(“file.txt”) as file: contents = file.read()
  17. Writing to a file with open(“file.txt”, “w”) as file: file.write(“Hello, World!”)
  18. Exception handling try: x = 1 / 0 except ZeroDivisionError: print(“Cannot divide by zero”)
  19. Sorting a list my_list.sort()
  20. Reversing a list my_list.reverse()
  21. Splitting a string my_string = “Hello, World!” my_list = my_string.split(“,”)
  22. Joining a list into a string my_list = [“Hello”, “World”] my_string = ” “.join(my_list)
  23. Checking if an item is in a list if “apple” in my_list: print(“Yes, apple is in the list”)
  24. Mapping a function to a list my_list = [1, 2, 3, 4, 5] new_list = list(map(lambda x: x * 2, my_list))
  25. Filtering a list my_list = [1, 2, 3, 4, 5] new_list = list(filter(lambda x: x % 2 == 0, my_list))
  26. List comprehension my_list = [1, 2, 3, 4, 5] new_list = [x * 2 for x in my_list]
  27. Dictionary comprehension my_dict = {‘a’: 1, ‘b’: 2, ‘c’: 3} new_dict = {k: v * 2 for k, v in my_dict.items()}
  28. Lambda function my_lambda = lambda x: x * 2
  29. Decorator function def my_decorator(func): def wrapper(): print(“Before function”) func() print(“After function”) return wrapper

@my_decorator def my_function(): print(“Hello, World!”)

  1. Class inheritance class Parent: def init(self): print(“Parent constructor”)

class Child(Parent): def __init