Monday, 4 November 2024

FPP Python Assignment no 1 to 5 Theory and Flowchart.



 
Assignment No:01

Problem Statement: 
a) Display your name, count length and display what will be your age in year. 
b) Write python program to calculate arithmetic operation using type conversion.

Aim:  Basic operations on numbers and strings using python.

Learning Objectives:
  • To understand the basics about python programming.
  • To learn how to write and execute python program.
Learning Outcomes:
  • Upon completing this lab exercise, the learner will be able to
  • Write a basic python program.
  • Interpreted and run python program.
  • Understand the identifiers and operators in python. 

Theory:
  1. What is Python?
  2. Why is python called as dynamic typing language?
  3. How to store different types of data inside python identifier?
  4. What is the difference between interpreter and compiler?
  5. What is classpath? why do need it?
  6. Explain the steps to execute python program through command prompt?
  7. What is IDLE?
  8. What is mean by comment in python and how many types of comments? 
  9. What is mean by type conversion in python?
  10. How do we accept various types of input from the user in python programming?

Algorithm:
a) Algorithm for display your name, count length and display what will be your age in year.
Step 1: Start
Step 2: Accept the name from the user.
Step 3: Find out the length of that name.
Step 4: Accept your birth year from the user.
Step 5: Find the age = current_year - birth_year.
Step 6: Display the name along with its length and age in year.
Step 7: Stop.

b) Algorithm for write python program to calculate arithmetic operation using type conversion.
Step 1: Start
Step 2: Accept the two numbers num1 and num2 from user.
Step 3: Find out the addition of these two numbers (sum = num1+num2)
Step 4: Display the addition of two numbers
Step 5: Find out the subtraction of these two numbers (sub = num1-num2)
Step 6: Display the subtraction of two numbers
Step 7: Find out the multiplication of these two numbers (mul = num1*num2)
Step 8: Display the multiplication of two numbers
Step 9: Find out the division of these two numbers (div = num1/num2)
Step 10: Display the division of two numbers
Step 11: Stop.

Flowchart:

a) Flowchart for display your name, count length and display what will be your age in year.

b) Flowchart for python program to calculate arithmetic operation using type conversion.



Conclusion: Hence, we learn how to execute the python program through command line argument and also learn how to accept input from the user and how to process this input with basic arithmetic operations.

-----------------------------------------------------------------------------------------------------------------------------

Assignment No:02

Problem Statement: Write simple python program that demonstrates the use of lists, tuples, and dictionaries

Aim: To learn basic data structures of python.

Learning Objectives:
  • To understand the basics about python data structures.
  • To learn how to create and manipulate data inside lists, tuples and dictionaries.

Learning Outcomes:
  • Upon completing this lab exercise, the learner will be able to
  • Write a basic python data structures syntax and semantics.
  • How to create empty list and how to perform various operations on lists for data manipulations.
  • How to create empty tuple and how to perform various operations on tuple for data manipulations.
  • How to create empty dictionary and how to perform various operations on dictionary for data manipulations.

Theory:
  1. What are the mutable and immutable objects in python?
  2. How to create and access elements from lists?
  3. How to modify and slice the lists elements?
  4. What is mean by nested list explain with example?
  5. What type of data we can store in list?
  6. How to create and access elements from Sets?
  7. How to perform various operations on the Sets?
  8. What is the difference between set and frozen set?
  9. Why do we require dictionaries in python?
  10. Explain the copying collections: shallow copy and deep copy with example?

Algorithm:
Algorithm:
a) Algorithm for list creation and various operation.
Step 1: Start
Step 2: Create an empty list like my_empty_list.
Step 3: Create list of string, integer, float number.
Step 4: Create list of different data types and duplicate numbers.
Step 5: Find the age = current_year - birth_year.
Step 6: Display the name along with its length and age in year.
Step 7: Stop.

Flowchart:
1) Flowchart for python program that demonstrates the use of lists, tuples, and dictionaries






Conclusion: Hence, we learn how to implement the python basic data structures like list, tuple, dictionary and also learn various operation of those data structures.

-----------------------------------------------------------------------------------------------------------------------------

Assignment No:03

Problem Statement: Write a function to calculate factorial of a number. Develop a program to compute binomial coefficient (Given N and R).

Aim: To implement function using python programming.

Learning Objectives:
  • To understand the basics about python functions.
  • To learn how to create and manipulate data inside functions.
  • To learn types of functions.

Learning Outcomes:
  • Upon completing this lab exercise, the learner will be able to
  • Write a basic python function syntax and semantics.
  • To implement functions for various task.
  • Clear the difference between user defined function and built in function.

Theory:
  1. Why is indenting required in python?
  2. Explain with example all decision-making statement in python?
  3. Explain with example nested if else statement?
  4. Why do we require iteration statement in python?
  5. Explain with example while loop in python?
  6. Explain with example for loop with break and continue statement in python?
  7. What is function? also explain why do we require functions in python programming language?
  8. What is map () function explain with example?
  9. What is filter () function explain with example?
  10. What is lambda () function explain with example?

Algorithm:
a) Algorithm for factorial of any number and compute binomial coefficient.
Step 1: Start
Step 2: Accept N and R from the user.
Step 3: using function of factorial compute the factorial of N.
Step 4: Display the factorial of value N.
Step 5: Compute the binomial coefficient of N and R (N!) /((N!) *(N-R)!)
Step 6: Display the binomial coefficient of N and R.
Step 7: Stop.

Flowchart:
1) Flowchart for python program that demonstrates the factorial of any number.





Conclusion: Hence, we learn how to implement the function like user defined function for computation of factorial of any number n.

-----------------------------------------------------------------------------------------------------------------------------

Assignment No:04

Problem Statement: Develop a Python program to check whether a given number is palindrome or not and also count the number of occurrences of each digit in the input number.

Aim: To understand the uses of looping and decision-making statement.

Learning Objectives:
  • To understand the basics about python decision making statement.
  • To understand the basics about python looping statements.
Learning Outcomes:
  • Upon completing this lab exercise, the learner will be able to
  • Write a basic python looping statement syntax and semantics.
  • How and when to use decision making statements.
Theory:

  1. What is object-oriented programming?
  2. What is class and objects explain with example?
  3. What encapsulation and abstraction explain with example?
  4. What is mean by Inheritance explain with example?
  5. What does constructor explain all types of constructors?

Algorithm:

a) Algorithm to check whether a given number is palindrome or not and also count the number of occurrences of each digit in the input number.

Step 1: Start
Step 2: Accept number n from user.
Step 3: using user defined function of reverse, reverse the number n and store it into rev identifier.
Step 4: Check number n and rev are equal or not. if equal show palindrome else shoe not palindrome message to the user.
Step 5: Compute the occurance of each digit inside the number n using user defined function.
Step 6: Display the count of occurance of each digit.
Step 7: Stop

Flowchart: Draw this flowchart by your own.

Conclusion: Hence, we learn how to implement the function, looping and decision-making statements to develop a logic to check whether given number is palindrome or not.

-----------------------------------------------------------------------------------------------------------

Assignment No:05

Problem Statement: Develop a program to read the student details like name, USN and marks in 3 subjects. Display the student details, total marks and percentage with suitable messages

Aim: To implement class by using student entity.

Learning Objectives:
  • To understand difference between procedure-oriented language and object-oriented language.
  • To understand the uses of oops features like encapsulation and data hiding.
  • To understand the syntax of writing class.
Learning Outcomes:
  • Upon completing this lab exercise, the learner will be able to
  • Able to map any entity into the class.
  • Able to analyze the problem statement.
  • Able to identify properties and behavior of entity.

Theory:
 
  1. Explain different types of Inheritance?
  2. Explain the term: Operator overloading, Method Overloading, Method Overriding
  3. What is exception handling? 
  4. What is file? how to perform reading and writing operation on file?
  5. Explain seek (), tell (), readline(), readlines() methods.

Algorithm:

a) Algorithm for display the student details, total marks and percentage with suitable messages
Step 1: Start
Step 2: Accept student name, USN and marks of three subjects (FPP, AC, SPM)
Step 3: using function find out the total of three subjects.
Step 4: Using function find out the percentage of students.
Step 5: Display all the details of student.
Step 6: Stop


Flowchart: Draw this flowchart by your own.

Conclusion: Hence, we learn how to implement the class in python along with its object creation and calling of functions as per the priority user requirement. 

data structures and algorithms Web Developer

1 comment: