0% found this document useful (0 votes)
4 views

Lab Sheet

Work that I do in lab

Uploaded by

sainilavi004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Lab Sheet

Work that I do in lab

Uploaded by

sainilavi004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Lab Sheet-02

Operators and Control Structures

1. Write a Python program to perform addition, subtraction, multiplication, and division of


two numbers entered by the user.
2. Using conditional operators, write a Python script to check if a number is even or odd.

3. Write a Python program using logical operators to check if a number lies between two
other numbers. Take all three numbers in the input and check the above for the third input.
4. Write a Python program using if-else to find the largest of three numbers.
5. Write a Python program to categorize a given integer as positive, negative, or zero using
an if-elif-else ladder.
6. Using nested if statements, write a Python program to check if a number is both divisible
by 5 and even.
7. Write a Python script using a for loop to print the first 10 natural prime numbers.
8. Using a while loop, write a program that prints the Fibonacci series up to a given number.

9. Write a Python program that breaks out of a loop when a user enters a negative number.

You might also like