Exp.
- 1: Write a program to find the largest element among three Numbers
Syntax:
Output:
Enter first number:
Enter second number:
Enter third number:
The largest number is:
Exp. - 2: Write a program to add and multiply complex numbers
Syntax:
Output:
Exp. – 3: Write a program to print multiplication table of a given number
Syntax:
Output:
Exp – 4:
Demonstrate the following Operators in Python with suitable examples.
i) Arithmetic Operators ii) Relational Operators
iii) Assignment Operators iv) Logical Operators
v) Bit wise Operators vi) Ternary Operator
vii) Membership Operators viii) Identity Operators
i) Arithmetic Operators
Used to perform mathematical operations.
Syntax:
ii) Relational (Comparison) Operators
Used to compare values.
iii) Assignment Operators
Used to assign values to variables.
iv) Logical Operators
Used to combine conditional statements.
v) Bitwise Operators
Operate on binary values.
vi) Ternary Operator
Used to make conditional assignments (short form of if-else).
vii) Membership Operators
Test for membership in a sequence (like list, string, tuple).
viii) Identity Operators
Compare memory locations of two objects.
Exp. - 5: Write a program to swap two numbers without using a temporary variable.
Syntax:
Output:
Exp - 6: Write a Program to display all prime numbers within an interval
Syntax:
Output:
Exp. 7: Write a program to define a function with multiple return values.
Syntax:
Output:
Expt. 8: Write a program to define a function using default arguments.
Syntax:
Exp.9: Write a program to find the length of the string without using any library functions.
Syntax:
Exp. 10: Write a program to check if the substring is present in a given string or not.
Syntax:
Exp. 11: Write a program to perform the given operations on a list:
i. Addition ii. Insertion iii. slicing
Syntax:
Exp. 12: Write a program to perform any 5 built-in functions by taking any list.
Syntax:
Exp.13: Write a program to create tuples (name, age, address, college) for at least two members and
concatenate the tuples and print the concatenated tuples.
Syntax:
Exp.14: Write a program to count the number of vowels in a string (No control flow allowed).
Syntax: