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

PR3 Python Practical

This document provides a comprehensive guide to Python programming with practical examples across various topics including basic programming, string manipulation, file handling, and NumPy. It includes solved problems such as calculating factorials, generating Fibonacci sequences, and checking for prime numbers, along with flowchart algorithms and viva questions. The guide serves as a resource for understanding fundamental Python concepts and operations.

Uploaded by

unicorn651596
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)
4 views3 pages

PR3 Python Practical

This document provides a comprehensive guide to Python programming with practical examples across various topics including basic programming, string manipulation, file handling, and NumPy. It includes solved problems such as calculating factorials, generating Fibonacci sequences, and checking for prime numbers, along with flowchart algorithms and viva questions. The guide serves as a resource for understanding fundamental Python concepts and operations.

Uploaded by

unicorn651596
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

PR3 – Python Programming Practical (Full Solved Guide)

PROGRAM SET 1 – Basic Python

----------------------------

1. Factorial

-------------

n=int(input("Enter number: "))

f=1

for i in range(1,n+1):

f*=i

print(f)

2. Fibonacci

------------

a,b=0,1

n=int(input())

for i in range(n):

print(a,end=" ")

a,b=b,a+b

3. Prime Check

--------------

n=int(input())

flag=True

for i in range(2,n):

if n%i==0:

flag=False

break
print("Prime" if flag else "Not Prime")

PROGRAM SET 2 – Strings/Lists

-----------------------------

• Reverse string

• Count characters

• Largest in list

• Sort list

PROGRAM SET 3 – File Handling

-----------------------------

f=open("[Link]","r")

data=[Link]()

print(data)

PROGRAM SET 4 – NumPy

---------------------

import numpy as np

a=[Link]([1,2,3])

b=[Link]([4,5,6])

print(a+b)

print([Link]())

FLOWCHART/ALGORITHM

-------------------

• Largest of 3 numbers

• Sum of digits

• GCD
VIVA QUESTIONS

--------------

• What is slicing?

• Mutable vs immutable?

• What is recursion?

• Python indentation?

You might also like