Professional Documents
Culture Documents
PE Ejournal 1431
PE Ejournal 1431
Certificate
Date:
Place:
TABLE OF CONTENTS
Sr.No. CONTENTS Date Page No.
Install Anaconda and Anaconda Navigators (use of spyder,
1
Jupyter and colab notebook).
Implement Basics of python:
a. Write a program to read (input ()) Celsius temperature and
print (print ()) equivalent Fahrenheit temperate on screen.
Picture 7 ...
b. Write three functions that calculate the remainder of two
integers by using: (a)the basic operators of +, -, * and /
(why is // not required?) (b)the divmod function(c)the %
operator
c. Copy-paste this super-nested Python list-dictionary:
Test=[{‘Arizona’: ‘Phoenix’, ‘California’: ‘Sacramento’,
‘Hawaii’: ‘Honolulu’}, 1000,2000,3000,[‘hat’, ‘t-shirt’,
2 18/01/22
‘jeans’, {‘socks1’: ‘red’, ‘socks2’: ‘blue’}]](a)Return
2000 on your screen. (b)Return the dictionary of the cities
and states on your screen. (This=[{‘Arizona’: ‘Phoenix’,
‘California’: ‘Sacramento’, ‘Hawaii’: ‘Honolulu’}.
(c)Return the list of the clothes on your screen! (This,
[‘hat’, ‘t-shirt’, ‘jeans’, {‘socks1’: ‘red’, ‘socks2’:
‘blue’}]) (d) Return the word ‘Phoenix’ on your screen.
(e) Return the word ‘jeans’ on your screen. (f)Return the
word ‘blue’ on your screen.
Write a Python program to check whether a character is
3 22/02/22
uppercase or lowercase alphabet.
Create a Python script that finds out your age in a maximum
of 10 tries. The script can ask you only one type of question:
4 guessing your age! (e.g. “Are you 67 years old?”) And you 22/02/22
can answer only one of these three options: (a)Less (b)More
(c)Correct
Write a Python program to find factorial of given number
5 (using fact() function). 08/03/22
Picture 7 ...
EXPERIMENT NO: 02
EXPERIMENT NO: 02
Program: (Students write program by hand/ type program/ Copy past screen
shot)
a)
tempF=tempC*1.8+32
print(tempF)
print("temperature in Celcius=",tempC,"C")
print("temperature in Fahrenheit=",tempF,"F")
b)
print("Remainder=",a-b*(a//b))
print("Remainder=",a%b)
print("Remainder=",divmod(a,b)[1])
c)
print("This=",Test[0])
print(Test[0]['Arizona'])
print(Test[4][2])
print(Test[4][3]['socks2'])
b)
c)
Picture 7 ...
Conclusion:
From this we understand the use of Python variables and basic Operators.
Declaring and using Numeric data types , using string data type and string
operations. Defining list and list slicing, list manipulation using built in
methods.We also learnt use of Tuple data type and Dictionary manipulation.
EXPERIMENT NO : 03
EXPERIMENT NO: 03
Program: (Students write program by hand/ type program/ Copy past screen
shot)
# Method 1: Without ASCII code
ch = input(print('Enter a character'))
if(ch >= 'A' and ch <= 'Z'):
print('Character is uppercase')
elif(ch >= 'a' and ch <='z'):
print('Character is lowercase')
elif(ch >= '0' and ch <= '9'):
print('Character is decimal')
else:
print('Entered value is neither of all')
a)
Picture 7 ...
b) )
Co
nclusion:
From these we understand how to use Conditional blocks using if , else & elif and
Python Programming using Conditional blocks .
Picture 7 ...
EXPERIMENT NO : 04
1. TITLE OF EXPERIMENT: Create a Python script that finds out your age in a
maximum of 10 tries. The script can ask you only one type of question: guessing
your age! (e.g. “Are you 67 years old?”) And you can answer only one of these three
options: (a)Less (b)More (c)Correct
EXPERIMENT NO: 04
Aim:Create a Python script that finds out your age in a maximum of 10 tries. The
script can ask you only one type of question: guessing your age! (e.g. “Are you 67
years old?”) And you can answer only one of these three options: (a)Less (b)More
(c)Correct
Program: (Students write program by hand/ type program/ Copy past screen
shot)
Picture 7 ...
min_age = 0
max_age = 100
running = True
for i in range(1,10):
while running:
if ans=='correct':
print("its correct guess")
running = False
break
else:
print("its wrong choice,please make correction")
Picture 7 ...
Conclusion:
From this we understand the using for loop , while loop , if else , elif concept.
Picture 7 ...
EXPERIMENT NO : 05
EXPERIMENT NO: 05
Aim:Write a Python program to find factorial of given number (using fact() function).
Program: (Students write program by hand/ type program/ Copy past screen
shot)
def fact(a):
factorial = 1
if a < 0:
print("Factorial of a negative number does not exist")
elif a==0:
print("Factorial of 0 is 1")
else:
for i in range(1,a+1): Picture 7 ...
factorial = factorial*i
print("Factorial of given number is", factorial)
k = int(input("Enter your number\n"))
fact(k)
def fact(a):
factorial = 1
if a < 0:
print("Factorial of a negative number does not exist")
elif a==0:
print("Factorial of 0 is 1")
else:
i=1
while i<=a:
factorial = factorial*i
i=i+1
print("Factorial of given number is", factorial)
k = int ( input ( "Enter your number\n" ))
fact(k)
Output: (Students write program output by hand/ type program output/
Copy past screen shot)
1)
2)
Picture 7 ...
Conclusion:
From this we understand how to use the user defined function ; it also
clears the concept of for loop and while loop.
Picture 7 ...
EXPERIMENT NO : 06
EXPERIMENT NO: 06
Aim:Write a python program to create two 3X3 random matrixes and perform
following operation: (a) Addition (b) subtraction (c) multiplication and display shape,
dimensions, dtype, Rank and flatten output of every o/p matrix.
Program: (Students write program by hand/ type program/ Copy past screen
shot)
import numpy as np
A1 = np.array([[1,2,3],[3,4,5],[6,7,8]]) print("\n1st Matrix=\n",A1)
A2 = np.array([[8,9,10],[11,12,13],[14,15,16]])
print("\n2nd Matrix=\n",A2)
Picture 7 ...
#a)
print("\nAddition of two Matrix=\n",A1+A2)
#b)
print("\n Subtraction of two Matrix=\n",A1-A2)
#c)
print("\n Multiplication of two Matrix=\n",A1*A2)
Picture 7 ...
Conclusion:
Picture 7 ...
EXPERIMENT NO : 07
TITLE OF EXPERIMENT : Write a Python program to read a given .txt file and
count total number of ‘the’ in the given file, find total words and total lines in the file
EXPERIMENT NO: 07
Aim:Write a Python program to read a given .txt file and count total number of ‘the’ in
the given file, find total words and total lines in the file.
Picture 7 ...
Program: (Students write program by hand/ type program/ Copy past screen
shot)
Conclusion: