0% found this document useful (0 votes)
31 views23 pages

Python

The document contains programs written by Tanvi Kocharekar to demonstrate various Python concepts like calculating a user's 100th birthday, checking if a number is even or odd, positive or negative, generating Fibonacci series, printing patterns like stars, numbers, pyramids, adding and calculating numbers, string slicing, functions on strings like upper(), lower(), title(), swapcase(), capitalize(), using lists, checking for leap years, calculating factorials, and checking for prime numbers. For each concept, the program code and output are included.
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)
31 views23 pages

Python

The document contains programs written by Tanvi Kocharekar to demonstrate various Python concepts like calculating a user's 100th birthday, checking if a number is even or odd, positive or negative, generating Fibonacci series, printing patterns like stars, numbers, pyramids, adding and calculating numbers, string slicing, functions on strings like upper(), lower(), title(), swapcase(), capitalize(), using lists, checking for leap years, calculating factorials, and checking for prime numbers. For each concept, the program code and output are included.
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/ 23

Roll

No.2211 Name:-Tanvi
Kocharekar
Name: vaishnavi prakash bote
Roll No:2167
Section: A

Practical No.1

a) Create a program that asks the user to enter their name and
their age.Print out a message addressed to them that tells them the
year that tells them the year that they will turn 100 years old.

Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar

b) Enter the number from the user and depending on whether the
number is even or odd, print out an appropriate message to the
user.

Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar

c) Enter the number from the user and depending on whether the
number is positive or negative, print out an appropriate message
to the user.
Program:-
Roll
No.2211 Name:-Tanvi
Kocharekar
Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar

d] Aim:- Write a program to generate the Fibonacci series.


Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar

e] Aim:- Write a python program to generate the various patterns.


i) Star pattern
Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar

ii) Number pattern


Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar

iii) Reverse star pattern


Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
iv) Pyramid star pattern
Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
v) Reverse Right-angled triangle pattern.
Program:
- Output:-
vi) Square Pattern.
Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
vii) Write a python program to add two numbers from user input.

Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
viii) Write a python program to calculate to add two numbers
from user input.

Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
e) i) String Slicing

Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
ii) String Slicing using Index Sequence

Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
iii) Python code to demonstrate String length using len.

Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
iv) Python program to show the working of upper() function.

Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
v) Python program to show the working of lower() function.
Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
vi) Python program to show the working of title() function.
Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
vii) Python program to show the working of swapcase() function.
Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
vii)Python program to show the working of capitalize() function.
Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar
f)Show the use of list in python
Program:-

Output:-
Roll
No.2211 Name:-Tanvi
Kocharekar

f) Leap Year program


Program:-

Output:

g) FActorial number
Program:-
Roll
No.2211 Name:-Tanvi
Kocharekar

Output:

h) Prime Number
Program:
- Output:-

You might also like