Python Practical
Python Practical
– 81
IT-605
Programming in Python
[1]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Index
[2]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-1
Program:
[3]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Output:
[4]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-2
Program:
Output:
[5]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-3
Aim: Write a program to create, concatenate and print a string and accessing
sub-string from a given string
Program:
Output:
[6]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-4
Aim: Write a python script to print the current date in following format “Sun
May 29 02:26:23 IST 2017”
Program:
import time;
ltime=time.localtime();
print(time.strftime("%a %b %d %H:%M:%S %Z %Y",ltime)); #returns the
formatted time
'''
%a : Abbreviated weekday name.
%b : Abbreviated month name.
%d : Day of the month as a decimal number [01,31].
%H : Hour (24-hour clock) as a decimal number [00,23].
%M : Minute as a decimal number [00,59].
%S : Second as a decimal number [00,61].
%Z : Time zone name (no characters if no time zone exists).
%Y : Year with century as a decimal number.'''
Output:
[7]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-5
Aim: Write a python program to create, append, and remove lists in python
Program:
Output:
[8]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-6
Program:
Output:
[9]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-7
Program:
[10]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Output:
[11]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-8
Program:
Output:
[12]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-9
Output:
[13]
Enrolment No. – 0103IT191082 Class Roll No. – 81
Experiment-10
Aim: Write a python program to print prime numbers less than 20.
Program:
Output:
[14]