Professional Documents
Culture Documents
ROLLNO. – 2023UIT3122
BRANCH – IT
SECTION – 2
COURSE – BTECH.
SUBJECT – COMPUTER
PROGRAMMING
SUBJECT CODE – FCCS0102
AIM:-
CODE :-
print(“Hello , World”)
RESULT:-
Exp: Write a python program to check if a number is even or odd
INPUT:
num=int(input("Enter number: "))
if (num%2) == 0:
print( num,"is even number")
else: print(num,"is odd number")
OUTPUT:
AIM : create and manipulate numpy array, perform basic operations and indexing on array
CODE
import numpy as np
array =np.array([1,2,3,4,5,6,7,8,9,10])
#addition
addition=array +1
#subtraction
subtraction=array-1
#multiplication
multiplication=array*5
#division
division=array/3
#taking square
square=array**2
#square root
sq_root=array**0.5
first_element=array[0]
range_of_element=array[1:9]
print("adition of 1 in array",addition)
print("square of array",square)
OUTPUT
AIM :-
CODE:-
if num % 2 == 0:
else:
a=divide(3,4)
print(a)
OUTPUT:
AIM:-
CODE :-
num_terms = int(input("Enter the number of terms for Fibonacci series: "))
first_term, second_term = 0, 1
print("Fibonacci Series:")
print(first_term)
print(second_term)
print(next_term)
RESULT:-
AIM:- Import and use external packages (eg. MATH ,RANDOM)
CODE :-
import math
angle_rad = math.radians(95)
sin_val = math.sin(angle_rad)
cos_val = math.cos(angle_rad)
print(f"Sin(45 degrees) is approximately: {sin_val}")
print(f"Cos(45 degrees) is approximately: {cos_val}")
Imoprt random
fruits = ["Apple", "Banana", "Cherry", "Orange"]
random_fruit = random.choice(fruits)
print(f"Random Fruit: {random_fruit}")
RESULT:-
AIM : use dictionaries to store and retrive
student grades
CODE:
student_grades = {}
student_grades[student_name] = grade
def get_grade(student_name):
add_grade("Aman", 85)
add_grade("Rajit", 92)
add_grade("Mridul", 78)
OUTPUT:
2
AIM:-
def is_palindrome(s):
if is_palindrome(input_string):
else:
RESULT:-
AIM : use lambda function , map and filyer to perform operation on a
list
Code :
words = ["Apple", "Banana", "Avocado", "Cherry", "Apricot"]
filtered_words = list(filter(lambda x: x.startswith("A"), words))
print(filtered_words)
OUTPUT: