PPFD Set-1
PPFD Set-1
BACHELOR OF TECHNOLOGY
IV – SEM
COMPUTER SCIENCE & ENGINEERING
DEPARTMENT
Laboratory Manual
INDEX
1
2203031050602 PPFD Laboratory
CERTIFICATE
CSE-PIET 2
2203031050602 PPFD Laboratory
SET-1
Code:
# Fahrenheit to Celsius
def FtoC(Fahrenheit):
return(Fahrenheit- 32.0) * 5.0 / 9.0
Fahrenheit = 100
Celsius = FtoC(Fahrenheit)
print (Celsius)
# Celsius to Fahrenheit
def CtoF(Celsius):
return(celsius * 1.8) + 32
Celsius = 38
Fahrenheit = CtoF(Celsius)
print (Fahrenheit)
Output:
CSE-PIET 3
2203031050602 PPFD Laboratory
Code:
length = int(input())
width = int(input())
Output:
CSE-PIET 4
2203031050602 PPFD Laboratory
Code:
import string
import secrets
password = ""
for _ in range(9):
password += secrets.choice(string.ascii_lowercase)
password += secrets.choice(string.ascii_uppercase)
password += secrets.choice(string.digits)
password += secrets.choice(symbols)
print(password)
Output:
CSE-PIET 5
2203031050602 PPFD Laboratory
Code:
# Python program to get the average of a list
def Average(lst):
return sum(lst) / len(lst)
# Driver Code
lst = [15, 9, 55, 41, 35, 20, 62, 49]
average = Average(lst)
Output:
CSE-PIET 6
2203031050602 PPFD Laboratory
Code:
def ISLP(y):
if((y % 400 == 0)or(y % 100 != 0)and(y % 4 == 0)):
return 1;
else:
return 0;
if __name__=='__main__':
year = 2020;
print(ISLP(year));
Output:
CSE-PIET 7
2203031050602 PPFD Laboratory
Code:
def factorial(n):
num = 7
print("Factorial of",num,"is",factorial(num))
Output:
CSE-PIET 8
2203031050602 PPFD Laboratory
Code:
def isPalindrome(s):
return s == s[::-1]
s = "malayalam"
ans = isPalindrome(s)
if ans:
print("Yes")
else:
print("No")
Output:
CSE-PIET 9
2203031050602 PPFD Laboratory
Code:
alphabets = ['a','e','d','c','b']
alphabets.sort()
print(alphabets)
random_numbers = [2,5,6,1,8,3]
random_numbers.sort()
print(random_numbers)
Output:
Code:
num = 52
Output:
10. A program that converts a given number from one base to another.
CSE-PIET
11
2203031050602 PPFD Laboratory
Code:
def decimal_to_binary(dec):
decimal = int(dec)
def decimal_to_octal(dec):
decimal = int(dec)
def decimal_to_hexadecimal(dec):
decimal = int(dec)
dec = 16
decimal_to_binary(dec)
decimal_to_octal(dec)
decimal_to_hexadecimal(dec)
Output:
CSE-PIET
12