0% found this document useful (0 votes)
4 views5 pages

Beginner_Python_Programs_Lab_Manual

The document is a lab manual for beginner Python programs, detailing five experiments that demonstrate basic programming concepts. Each experiment includes a problem statement, theory, program code, output, and conclusion, covering topics such as list operations, voting eligibility, even/odd number determination, leap year checking, and vowel identification. The manual serves as a practical guide for beginners to learn fundamental Python programming skills.

Uploaded by

sharvil.sopal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

Beginner_Python_Programs_Lab_Manual

The document is a lab manual for beginner Python programs, detailing five experiments that demonstrate basic programming concepts. Each experiment includes a problem statement, theory, program code, output, and conclusion, covering topics such as list operations, voting eligibility, even/odd number determination, leap year checking, and vowel identification. The manual serves as a practical guide for beginners to learn fundamental Python programming skills.

Uploaded by

sharvil.sopal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Lab Manual for Beginner Python

Programs
Experiment 1: Program to Demonstrate Operations on Lists

Aim/Problem Statement:
To demonstrate basic operations on lists such as adding, removing, and accessing elements.

Theory:
In Python, lists are used to store multiple items in a single variable. Lists are ordered,
changeable, and allow duplicate values. Operations such as appending, removing, and
accessing elements are common.

Program:

# Demonstrating basic operations on lists

# Creating a list
numbers = [10, 20, 30, 40, 50]

# Adding an element
numbers.append(60)

# Removing an element
numbers.remove(30)

# Accessing elements
print("First element:", numbers[0])

# Slicing
print("List from index 1 to 3:", numbers[1:4])

# Displaying the updated list


print("Updated List:", numbers)

Output:

First element: 10
List from index 1 to 3: [20, 40, 50]
Updated List: [10, 20, 40, 50, 60]

Conclusion:
This program demonstrates how to perform various operations on lists, such as appending
elements, removing elements, and slicing.

Experiment 2: Program to Determine Whether a Person is Eligible to Vote


or Not

Aim/Problem Statement:
To check if a person is eligible to vote based on their age.

Theory:
A person is eligible to vote if their age is 18 or above. This is the voting age limit in most
countries, including India.

Program:

# Program to check eligibility to vote

age = int(input("Enter your age: "))

if age >= 18:


print("You are eligible to vote.")
else:
print("You are not eligible to vote.")

Output:

Enter your age: 20


You are eligible to vote.

Conclusion:
This program takes the user's age as input and checks whether the age is greater than or
equal to 18, determining their eligibility to vote.
Experiment 3: Program to Find Whether the Given Number is Even or Odd

Aim/Problem Statement:
To determine whether a given number is even or odd.

Theory:
A number is even if it is divisible by 2 with no remainder. A number is odd if the remainder
when divided by 2 is 1.

Program:

# Program to check if a number is even or odd

num = int(input("Enter a number: "))

if num % 2 == 0:
print(num, "is Even")
else:
print(num, "is Odd")

Output:

Enter a number: 7
7 is Odd

Conclusion:
This program checks whether a number is even or odd using the modulus operator.

Experiment 4: Program to Find Whether the Given Year is a Leap Year or


Not

Aim/Problem Statement:
To determine whether a given year is a leap year.

Theory:
A year is a leap year if it is divisible by 4, but not divisible by 100 unless it is also divisible by
400.

Program:

# Program to check leap year


year = int(input("Enter a year: "))

if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):


print(year, "is a Leap Year")
else:
print(year, "is not a Leap Year")

Output:

Enter a year: 2020


2020 is a Leap Year

Conclusion:
This program correctly identifies leap years based on the given conditions.

Experiment 5: Program to Determine Whether the Character Entered is a


Vowel or Not

Aim/Problem Statement:
To determine whether a character entered is a vowel or not.

Theory:
Vowels are the characters "a", "e", "i", "o", "u" in both lowercase and uppercase. This
program checks if the entered character belongs to the set of vowels.

Program:

# Program to check if a character is a vowel

ch = input("Enter a character: ").lower()

if ch in ['a', 'e', 'i', 'o', 'u']:


print(ch, "is a Vowel")
else:
print(ch, "is not a Vowel")

Output:

Enter a character: A
A is a Vowel

Conclusion:
The program successfully checks whether the entered character is a vowel or not by
comparing it with the list of vowels.

You might also like