Practical List - Python [ 4330701 ] [ PRACTICAL EXERCISES ] - Computer Bits Daily

Python Program Example
Practical Outcomes : Environment Setup
1 Install and configure the Python environment. Run basic Python commands to verify the Python environment - Click to learn more
   
Practical Outcomes : Input-Output
1 PYTHON PROGRAM TO PRINT "HELLO PYTHON LEARNER" - Click to learn more
2 Write a program to read your name, contact number, email, and birthdate and print those details on the screen.
Practical Outcomes : Variables, operators, Expressions
1 Write a program to convert temperature from Celsius to Fahrenheit. Equation to convert Celsius to Fahrenheit: F = (9/5) * C + 32.
2 Python program to convert Fahrenheit to Celsius. [ Formula : Celsius = (Fahrenheit – 32) * 5/9 ]
3 Write a program to compute the slope of a line between two points (x1, y1) and (x2, y2). [ slope = y2-y1/x2-x1 ]
4 Write a program to calculate simple and compound interest.[ Simple interest = (P * N * R)/100, Compound interest =P * (pow((1 + R / 100), N))
5 WRITE A PROGRAM TO GET CHANGE VALUES IN QUARTER, DIME, NICKELS AND PENNIES, AND CALCULATE THE VALUE OF CHANGE IN DOLLARS. CONSIDER QUARTER = 0.25 $, DIME = 0.10 $, NICKELS = 0.05 $ AND PENNY = 0.01 $.
6 WRITE A PROGRAM TO FIND A MAXIMUM OF GIVEN THREE NUMBERS (USE TERNARY OPERATOR).
7 WRITE A PROGRAM TO CALCULATE AREA AND VOLUME OF SPHERE. [ AREA OF SPHERE =4ΠR², VOLUME OF THE SPHERE =(4/3)*ΠR³.]
8 WRITE A PROGRAM THAT COMPUTES THE REAL ROOTS OF A GIVEN QUADRATIC EQUATION (USE MATH LIBRARY). [ DISCRIMINANT = B^2-4AC , THE ROOTS ARE {-B + √(B^2 – 4AC)}/2A AND {-B – √(B^2 – 4AC)}/2A.]
9 WRITE A PROGRAM TO DETERMINE THE LENGTH OF LADDER REQUIRED TO REACH A GIVEN HEIGHT WHEN LEANED AGAINST THE HOUSE. THE HEIGHT AND THE ANGLE OF THE LADDER ARE GIVEN AS INPUTS (USE MATH LIBRARY).
Practical Outcomes : Decision-Making Structures
1 A year is a Leap year if it is divisible by 4, unless it is a century year that is not divisible by 400 (1800 and 1900 are not leap years, 1600 and 2000 are leap years). Write a program that calculates whether a given year is a leap year or not.
2 Many companies pay time-and-a-half for any hours worked above 40 hours in a given week. Write a program to input the number of hours worked and hourly rate and calculate the total wages for the week.
3 The Body Mass Index (BMI) is calculated as a person's weight (in kg), divided by the square of the person's height (in meters). If the BMI is between 19 and 25, the person is healthy. If the BMI is below 19, then the person is underweight. If the BMI is above 25, then the person is overweight. Write a program to get a person's weight (in kgs) and height (in cms) and display a message whether the person is healthy, underweight or overweight. [ BMI = (Weight in Kilograms / (Height in Meters x Height in Meters)) ]
4 Write a program to read the marks and assign a grade to a student. Grading system: A (>=90), B (80-89), C (70-79), D (60-69), E (50-59), F (<50). (Use the Switch case)
Practical Outcomes : Loops
1 Write a program to read n numbers from users and calculate the average of those n numbers.
2 Write a program that prompts the user to enter 10 integers and displays all the combinations of picking two numbers from the 10.
3

Write programs to print below patterns:

     *
   * *
  * * *
 * * * *
* * * * *

1
1 2
1 2 3
1 2 3 4
1 2 3 4 5

4 Write a program that displays an ASCII character table from ! to ~. Display the ASCII value of a character in decimal and hexadecimal. Display five characters per line.
5 Write a program to sum the following series: 1/3 + 3/5 + 5/7 + 7/9 + 9 /11 + 11/ 13 + ... + 95 /97 + 97 /99
6 A positive integer is called a perfect number if it is equal to the sum of all of its positive divisors, excluding itself. For example, 6 is the first perfect number, because 6 = 3 + 2 + 1, the next is 28 = 14 + 7 + 4 + 2 + 1. There are four perfect numbers that are less than 10,000. Write a program to find these four numbers.
Practical Outcomes : Lists
1

Write a program to perform the below operations on the list:

- Create a list.

- Add/Remove an item to/from a list.

- Get the number of elements in the list.

- Access elements of the list using the index.

- Sort the list.

- Reverse the list.

2

Write a program to read n numbers from a user and print:

- Number of positive numbers.

- Number of negative numbers.

- Number of zeros.

- Number of odd numbers.

- Number of even numbers.

- Average of all numbers.

3 Write a program that counts the occurrences of each digit in a string. The program counts how many times a digit appears in the string. For example, if the input is "12203AB3", then the output should output 0 (1 time), 1 (1 time), 2 (2 times), 3 (2 times).
4 Write a program to eliminate duplicate values in the list.
5 Write a program to randomly fill in 0s and 1s into a 4x4 2-dimension list, print the list and find the rows and columns with the most number of 1s.
Practical Outcomes : Tuples, Sets and Dictionaries
   
   
   

Post a Comment

0 Comments