0% found this document useful (0 votes)
3 views1 page

AIML Lab Assignment - 4

This document outlines a lab assignment for an Introduction to Artificial Intelligence and Machine Learning course. It includes tasks such as writing a Python program for encryption/decryption, using list comprehension for various operations, displaying string characters by index, and printing a specific pattern. Each task is clearly defined with input and output examples.

Uploaded by

hiwage2880
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

AIML Lab Assignment - 4

This document outlines a lab assignment for an Introduction to Artificial Intelligence and Machine Learning course. It includes tasks such as writing a Python program for encryption/decryption, using list comprehension for various operations, displaying string characters by index, and printing a specific pattern. Each task is clearly defined with input and output examples.

Uploaded by

hiwage2880
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Department of Computer Science and Engineering

Introduction to Artificial Intelligence and Machine


Learning
(CSN12601)
Lab Assignment – 4
S.NO. Questions
1. Write a python program to accept a message from a user and perform your own
Encryption/Decryption:

Example:
Message :: “The guy named John is a secret agent”
Encrypted Message :: “vjg"iw{"pcogf"Lqjp"ku"c"ugetgv"cigpv”
Decrypted Message :: “The guy named John is a secret agent”

( Use predefined methods “chr()” and “ord()” )


2. Perform various task using List Comprehension:

1) Input : ["Ramesh","Naveen","Rajesh","Alok"]
Output: ['R', 'N', 'R', 'A']

2) Common elements present in num1 and num2


Input:
num1=[10,20,30,40]
num2=[30,40,50,60]
Output:
[30, 40]

3) Input : ['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog']
Output: [['the', 3], ['quick', 5], ['brown', 5], ['fox', 3], ['jumps', 5], ['over', 4],['the', 3], ['lazy', 4], ['dog', 3]]
3. Write a program to accept some string from the keyboard and display its characters by
index wise(both positive and negative index):
Example:
Input: Hello
Output:
The character present at positive index 0 and at negative index -5 is h
The character present at positive index 1 and at negative index -4 is e
The character present at positive index 2 and at negative index -3 is l
The character present at positive index 3 and at negative index -2 is l
The character present at positive index 4 and at negative index -1 is o
4. Print the given pattern :
Pattern-5:
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ
ABCDEFGHIJ

You might also like