0% found this document useful (0 votes)
20 views20 pages

Python Journal

The document outlines a series of Python programming experiments, each demonstrating fundamental concepts such as output, arithmetic operations, conditionals, loops, and object-oriented programming. Each experiment includes a theory section, a sample program, and a conclusion confirming successful execution. Topics covered range from basic syntax and functions to more complex structures like classes and file handling.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views20 pages

Python Journal

The document outlines a series of Python programming experiments, each demonstrating fundamental concepts such as output, arithmetic operations, conditionals, loops, and object-oriented programming. Each experiment includes a theory section, a sample program, and a conclusion confirming successful execution. Topics covered range from basic syntax and functions to more complex structures like classes and file handling.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON PROGRAMMING JOURNAL

Date: 11-10-2025
Roll No: ____________

Experiment 1: Hello World Program


Theory: This program displays a basic output using Python's print() function.
Program:
print("Hello, World!")
Conclusion: The program successfully prints a message on the screen.

Theory:

In Python, the “Hello, World!” program is the first step to understanding how
output and functions work.
It teaches:

Syntax – how Python statements are written.

Functions – reusable blocks of code (like def in Python).

Loops – used to repeat actions.

Variables – used to store and manipulate data.

The print() function is used to display text or values on the screen.


We can extend the Hello World concept by using loops and functions to print
multiple greetings in different styles.

# Program: Hello World


Input

# This program prints Hello World on the screen

print("Hello, World!")

Output
Hello, World!
Experiment 2: Arithmetic Operations
Theory: Demonstrates basic arithmetic operations like addition, subtraction, multiplication,
and division.
Program:
a=10; b=5 print(a+b, a-b, a*b, a/b)
Conclusion: Basic arithmetic operations are performed successfully.
Experiment 3: Even or Odd Check
Theory: Checks whether a given number is even or odd using the modulus operator.
Program:
num=int(input("Enter number: ")) print("Even" if num%2==0 else "Odd")
Conclusion: Program checks even/odd correctly.
Experiment 4: Largest of Three Numbers
Theory: Uses the max() function to find the largest number among three values.
Program:
a,b,c=5,12,9 print(max(a,b,c))
Conclusion: Largest number found successfully.
Experiment 5: Prime Number Check
Theory: Determines whether a number is prime using a for loop and conditional
statements.
Program:
n=int(input("Enter number: ")) for i in range(2,n): if n%i==0:print("Not Prime");break
else:print("Prime")
Conclusion: Prime number check executed successfully.
Experiment 6: Fibonacci Series
Theory: Generates a sequence where each number is the sum of the two preceding ones.
Program:
a,b=0,1 for _ in range(5):print(a);a,b=b,a+b
Conclusion: Fibonacci sequence generated successfully.
Experiment 7: Factorial Program
Theory: Calculates the factorial of a number using a for loop.
Program:
n=5;fact=1 for i in range(1,n+1):fact*=i print(fact)
Conclusion: Factorial calculated successfully.
Experiment 8: Reverse String
Theory: Reverses a string using slicing technique in Python.
Program:
s="hello" print(s[::-1])
Conclusion: String reversed successfully.
Experiment 9: Count Vowels
Theory: Counts vowels in a given string using iteration and conditionals.
Program:
s="hello" count=sum(1 for i in s if i in "aeiou") print(count)
Conclusion: Vowels counted successfully.
Experiment 10: Sum of Digits
Theory: Adds all digits of a number using string conversion and list comprehension.
Program:
num=123 print(sum(int(i) for i in str(num)))
Conclusion: Sum of digits found successfully.
Experiment 11: Palindrome Check
Theory: Checks if a string is the same forwards and backwards.
Program:
s="madam" print("Palindrome" if s==s[::-1] else "Not Palindrome")
Conclusion: Palindrome check successful.
Experiment 12: Pattern Printing
Theory: Prints a simple pattern using nested loops or string repetition.
Program:
for i in range(1,6):print("*"*i)
Conclusion: Pattern printed successfully.
Experiment 13: Area of Circle
Theory: Calculates area using the formula πr².
Program:
r=5 print(3.14159*r*r)
Conclusion: Area calculated successfully.
Experiment 14: Addition Function
Theory: Defines and uses a function to add two numbers.
Program:
def add(a,b):return a+b print(add(5,10))
Conclusion: Function executed successfully.
Experiment 15: List Display
Theory: Creates a list and prints its elements using a loop.
Program:
lst=["apple","banana","cherry"] for i in lst:print(i)
Conclusion: List displayed successfully.
Experiment 16: Largest Element in List
Theory: Finds the largest number in a list using max().
Program:
lst=[4,7,2,9] print(max(lst))
Conclusion: Largest element found successfully.
Experiment 17: Dictionary Example
Theory: Shows the use of a dictionary with key-value pairs.
Program:
d={"name":"John","age":20} print(d)
Conclusion: Dictionary displayed successfully.
Experiment 18: File Handling
Theory: Demonstrates how to write to and read from a file.
Program:
open("[Link]","w").write("Python") print(open("[Link]").read())
Conclusion: File operations done successfully.
Experiment 19: Lambda Function
Theory: Uses lambda to compute the square of a number.
Program:
square=lambda x:x*x print(square(5))
Conclusion: Lambda function executed successfully.
Experiment 20: Class and Object
Theory: Demonstrates object-oriented programming using a simple class example.
Program:
class Student: def __init__(self,n):[Link]=n def show(self):print([Link])
Student("Sid").show()
Conclusion: Class and object used successfully.

You might also like