Q
Python Programming | Assignments
Home » Embedded Systems » Python Programming | Course Home » Python Programming | Assignments

Python Programming – Assignments

In Emertxe each one of our Assignments will ensure you apply the concept you have leant in your classroom. By solving these python assignments for beginners, you will go through a systematic problem-solving approach which include requirement understanding, algorithm design, pseudocode creation, dry run and final execution. As you move from simple to more complex assignments of each module it will slowly start building your self-confidence. 

Description:

In this python assignment user has to enter 3 values of different datatype into 3 different variables. After reading input, print the values and datatype of the variables.

Prerequisites:

  • Loops
  • List comprehension

Objective:

To understand the concept of eval() and type().

Inputs:

3 values of any datatype.

Sample Execution / Output:

Test Case :

 

Python Assignments for beginners

Description:

In this python assignment for beginners you need to identify whether user entered number is odd or even,

Prerequisites:

  • Loops
  • Arithmetic Operators
  • Nested if-else construct

Objective:

To understand the concept of nested if-else.

Inputs:

Integer ‘N’, where ‘N'< 220.

Sample Execution / Output:

Test Case :

 

Embedded Systems Course | Bengaluru | Emertxe

Description:

In this assignment you need to read 3 numbers from user and find the biggest among them and print the result.

Prerequisites:

  • Loops
  • Arithmetic Operators
  • Nested if-else construct

Objective:

To understand the concept of nested if-else.

Inputs:

Integer ‘N’, where ‘N'< 220.

Sample Execution / Output:

Test Case :

 

Python Assignments for beginners

Description:

In this python assignment for beginners you need to read a number from user. Based on the value, print the n number of rows with stars as the pattern given below.

If n = 2, then 2 rows. Number of stars increases by 1 from top to bottom.

*

*  *

Prerequisites:

  • Loops
  • Arithmetic Operators

Objective:

To understand the concept of for loop.

Inputs:

Integer ‘N’.

Sample Execution / Output:

Test Case 1:

 

Embedded Systems Course | Bengaluru | Emertxe

Description:

In this assignment you need to read a number from user. Based on the value, print the n number of rows with stars as the pattern given below.

If n = 2, then 2 rows. Number of stars increases by 1 from top to bottom.

*  *

*

Prerequisites:

  • Loops
  • Arithmetic Operators

Objective:

To understand the concept of for loop.

Inputs:

Integer ‘N’.

Sample Execution / Output:

Test Case :

Python Assignments for beginners

Description:

In this python assignment for beginners you need to read a number from user. Based on the value, print the n number of rows with the pattern given below.

If n = 2, then 2 rows. Numbers are increasing from top to bottom.

Prerequisites:

  • Loops
  • Arithmetic Operators

Objective:

To understand the concept of for loop.

Inputs:

Integer ‘N’.

Sample Execution / Output:

Test Case :

Embedded Systems Course | Bengaluru | Emertxe

Description:

In this assignment you need to read a number from user. Based on the value, print the n number of rows with pattern given below.

If n = 2, then 2 rows, where numbers are increasing from left to right.

1

1  2

Prerequisites:

  • Loops
  • Arithmetic Operators

Objective:

To understand the concept of for loop.

Inputs:

Integer ‘N’.

Sample Execution / Output:

Test Case :

Python Assignments for beginners

Description:

In this python assignment for beginners you need to read a number from user. Based on the value, print the n number of rows with multiples of 2 pattern given below.

If n = 2, then 2 rows, where numbers are increasing from left to right.

2

4  8

Prerequisites:

  • Loops
  • Arithmetic Operators

Objective:

To understand the concept of for loop.

Inputs:

Integer ‘N’.

Sample Execution / Output:

Test Case :

Embedded Systems Course | Bengaluru | Emertxe

Description:

In this assignment you need to read numbers into list. Find sum of elements using both built-in and loops methods.

Prerequisites:

  • Loops

Objective:

To understand the concept of for loop and lists.

Inputs:

Read elements into the list.

Sample Execution / Output:

Test Case 1:

Python Assignments for beginners

Description:

In this python assignment for beginners you need to read 2 values m and n from user where m < n. Print all the odd numbers between m and n.

Prerequisites:

  • Loops

Objective:

To understand the concept of for loop.

Inputs:

Integer m and n, where m < n.

Sample Execution / Output:

Test Case 1:

Embedded Systems Course | Bengaluru | Emertxe

Description:

In this assignment you need to read 2 values m and n from user where m < n. Print all the odd numbers between m and n.

Prerequisites:

  • Loops

Objective:

To understand the concept of while loop and range().

Inputs:

Integer m and n, where m < n.

Sample Execution / Output:

Test Case :

Python Assignments for beginners

Description:

In this python assignment for beginners you need to ask user to enter the username and print the name entered by the user.

Prerequisites:

  • Loops
  • Strings

Objective:

To understand the concept of while loop and strings.

Inputs:

Read a name from the user.

Sample Execution / Output:

Test Case :

Embedded Systems Course | Bengaluru | Emertxe

Description:

In this python assignment for beginners you need to read 2 numbers from the num1 and num2, where num1 < num2. Find all the prime numbers which are greater than num1 and less than num2.

Prerequisites:

  • Loops

Objective:

To understand the concept of nested looping.

Inputs:

2 integer num1 and num2, where num1 < num2.

Sample Execution / Output:

Test Case :

Python Assignments for beginners

Description:

  • In mathematics, the Fibonacci numbers or Fibonacci sequence are the numbers in the following integer sequence 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 . . . OR 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 . . .
  • By definition, the first two numbers in the Fibonacci sequence are either 1 and 1, or 0 and 1, depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two.
  • Based on input, user should print positive Fibonacci series or negative Fibonacci series

Prerequisites:

  • Loops

Objective:

To understand the concept of continous looping.

Inputs:

Integer ‘num’.

Sample Execution / Output:

Test Case :

Embedded Systems Course | Bengaluru | Emertxe

Description:

Read a string from the user. Check type of each character in a string

  • isalpha() – checks for an alphabetic character. The alphabetic character can be in upper case or lower case. It can be checked using islower () and isupper () methods.
  • isdigit() – checks for a numeric character

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of string testing methods.

    Inputs:

    A String.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • find () method returns first occurrence of a given sub string in main string.
    • Using find () method you need to print all positions of a given substring in a main string

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of find().

    Inputs:

    2 strings.

    Sample Execution / Output:

    Test Case :

     

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    • find () method returns the first occurrence of a given substring in the main string.

    • Using find () method you need to print all positions of a given substring in a main string

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of string and find() methods.

    Inputs:

    2 strings.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Python’s built-in function chr() is used for converting an Integer to a Character, while the function ord() is used to do the reverse, i.e, convert a Character to an Integer.
    • We need to read the string from the user where length of the string should be the even number. Based on the 1st character, we are modifying the second, based on 3rd character we need to modify the 4th character using chr() and ord() functions.

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of string’s ord() and chr().

    Inputs:

    1 string (length should be +ve even).

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    • If the user enters the string which contains both alphabets and numbers then we need to separate alphabets and digits such a way alphabets should be at the beginning of the string and digits should be at the end of the string.
    • If the string contains special characters, it will be neglected. We need to group alphabets and digits separately. isalpha() can be used to check whether an entered character is the alphabet or not and isdigit() is to check if the entered character is number or not.

    Prerequisites:

    • Strings

    Objective:

    In this python assignment for beginners objective is to understand the concept of isalpha()  and isdigit().

    Inputs:

    1 string.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    In this python assignment for beginners, read a substring from the user, and then concatenate the substring with main string.

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of string concatenation.

    Inputs:

    2 strings.

    Sample Execution / Output:

    Test Case 1: Positive Numbers:

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read a string with 2 characters where the 2nd character should be an integer. You need to create a new string by repeating the first character for ‘n’ times where ‘n’ is the second character in the string.

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of string repetition.

    Inputs:

    1 string.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read a string with one or more words. You need to reverse only the characters of the word. The output should look like mirrored words. You need to reverse all the words in the string.

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of string reverse.

    Inputs:

    1 string.

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read a string with one or more words. You need to reverse the order of the words in a string, i.e first word should be moved to last and last word position should be first.

    Prerequisites:

    • Strings

    Objective:

    In this python assignment for beginners the objective is to understand the concept of string.

    Inputs:

    1 string.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Read a string with one or more words. You need to sort the characters of the string based on the ASCII value in ascending order. 
    • Use sorted() function to sort the characters in a string.

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of string sorted() and join().

    Inputs:

    1 string.

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    • Read a string with one or more words. You need to sort the characters of the string based on the ASCII value in ascending order. 
    • Use sorted() function to sort the characters in a string.

    Prerequisites:

    • Strings

    Objective:

    To understand the concept of string sorted().

    Inputs:

    1 string.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read integers as input from the user. You need to leave space between the integers.  Apply bubble sort technique to sort the integers in the list

    Prerequisites:

    • Lists

    Objective:

    To understand the concept of accessing the elements in the list.

    Inputs:

    Read integers from the user(Leave space between the integers)

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read integers as input into the list and a number which needs to be checked. You need to compare a given number with all the elements of the list. If it’s matched increment the count and print number of occurrences of given number in the list

    Prerequisites:

    • Lists

    Objective:

    In this python assignment for beginners the objective is to understand the concept of accessing the elements in the list.

    Inputs:

    Read elements into the list and a number which needs to be checked

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read integers as input into the list and a number which needs to be checked. You need to use  built-in function count() to count a number of occurrences of the number in the list. If it’s matched, the return value will be greater than 0.

    Prerequisites:

    • Lists

    Objective:

    To understand the concept of count().

    Inputs:

    Read elements into the list and a number which needs to be checked

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read employee names as input into the list and a name of the employee which needs to be checked. You need to compare a given employee name with all the elements of the list. If it’s matched print “employee name is found in the list”.

    Prerequisites:

    • Lists

    Objective:

    To understand the concept of split() and accessing elements in the list

    Inputs:

    Read employee names into the list and a name which needs to be checked

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read integers as input into the list. Without using the built-in functions, you need to find the min and max elements of the list

    Prerequisites:

    • Lists

    Objective:

    To understand the concept of accessing elements in the list

    Inputs:

    Read integer values into the list

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read integers as input into the list. Using the built-in functions min() and max(), you need to find the min and max elements of the list

    Prerequisites:

    • Lists

    Objective:

    To understand the concept of min() and max()

    Inputs:

    Read integer values into the list

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read row and col from the user. Based on row and col values read elements into the matrix. U need to find the transpose of the matrix by replacing each row with respective column or vise versa and print the result.

    Prerequisites:

    • Lists

    Objective:

    To understand the concept of accessing elements in matrix

    Inputs:

    Read row, col from the user. Based on the values of row and col, read elements into the list/matrix

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read city names from the user. If city name length is >= 5, copy the city into list 2, else ignore it. You need to repeat this for all the names in the list.

    Prerequisites:

    • Lists comprehension

    Objective:

    To understand the concept of Lists comprehension

    Inputs:

    Read city names into the list

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read city names from the user. If city name length is >= 5, update the city name in uppercase and store in list_2, else ignore it. You need to repeat this for all the names in the list. 

    Prerequisites:

    • Lists comprehension

    Objective:

    To understand the concept of Lists comprehension

    Inputs:

    Read city names into the list

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read 2 numbers(m and n) from the user. U need to print a cube of numbers starting from m upto n. Store the result in List and print it.

    Prerequisites:

    • Lists comprehension

    Objective:

    In this python assignment for beginners the objective is to understand the concept of Lists comprehension

    Inputs:

    Read 2 numbers from the user

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read 2 numbers(m and n) from the user. U need to print a cube of numbers starting from m upto n. Store the result in List and print it.

    Prerequisites:

    • Lists comprehension

    Objective:

    To understand the concept of Lists comprehension

    Inputs:

    Read 2 numbers from the user

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read city names from the user. U need to fetch the first character of the string/city name. Store the result in List and print it.

    Prerequisites:

    • Lists comprehension

    Objective:

    To understand the concept of Lists comprehension

    Inputs:

    Read city names from the user

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read elements into the tuple and read an element which needs to be searched. U need to find the 1st occurrence of the given integer and print the index. We can implement using built-in functions and without using it. Implement in both ways.  

    Prerequisites:

    • Tuple

    Objective:

    To understand the concept of accessing elements in Tuple and index() 

    Inputs:

    Read integers into the Tuple

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read elements into the tuple and read an element which needs to be inserted and position. U need to insert the given integer at a given position in the tuple.  

    Prerequisites:

    • Tuple

    Objective:

    To understand the concept of Inserting elements in Tuple

    Inputs:

    Read integers into the Tuple, an integer and position

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read elements into the tuple and read an element which needs to be deleted and it’s position. If the element is found at a given position in the tuple, then you need to delete the element from the tuple. If an element is not found at a given position then print the error message.

    Prerequisites:

    • Tuple

    Objective:

    In this python assignment for beginners the objective is to understand the concept of Deleting elements in Tuple

    Inputs:

    Read integers into the Tuple, an integer and position

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Emertxe | Bangalore

    Description:

    Read elements into the tuple and read an element which needs to be replaced. If the element is found in the tuple, then you need to replace the old element with the new element in the tuple. If an element is not found then print the error message. 

    Prerequisites:

    • Tuple

    Objective:

    To understand the concept of Updating the elements in Tuple

    Inputs:

    Read integers into the Tuple, old_num and new_num

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read elements into the tuple. You need to find sum and average of elements of the tuple using built-in functions and without using built-in functions

    Prerequisites:

    • Tuple

    Objective:

    To understand the concept of sum() and len()

    Inputs:

    Read integers into the Tuple

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    Read the number of students, name and marks(in %) of each student into the dictionary. Read the name of the student and check whether the entered name is present in the dictionary. If found, print the student details, else print the error message.

    Prerequisites:

    • Dictionary

    Objective:

    To understand the concept of accessing elements from the dictionary

    Inputs:

    Read the number of students, name and marks of each student in the dictionary.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read the number of students, name and marks(in %) of each student into the dictionary. Display all the students name and marks using Dictionary

    Prerequisites:

    • Dictionary

    Objective:

    To understand the concept of accessing elements from the dictionary

    Inputs:

    Read the number of students, name and marks of each student in the dictionary.

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Emertxe | Bangalore

    Description:

    Read the string an n1 and n2 as position(where n1 < n2) from the user. You need to update the character to uppercase from position n1 to n2 . You need to update the string inside the function.

    Prerequisites:

    • Functions

    Objective:

    To understand the concept of functions

    Inputs:

    Read the string and 2 positions from the user.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    Read integers into 2 lists. Let’s say lst1 and lst2. You need to check whether elements of lst2 are present in lst1 in the same order. If the order is the same, the function should return true and if it didn’t match then the function should return false.

    Prerequisites:

    • Functions

    Objective:

    To understand the concept of functions

    Inputs:

    Read elements into 2 lists from the user.

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Emertxe | Bangalore

    Description:

    Read 2 integers from the user. Write a function to find the min and max among two numbers. Implement the logic using functions.

    Prerequisites:

    • Functions

    Objective:

    To understand the concept of functions

    Inputs:

    Read 2 elements from the user.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Read 2 strings from the user. Write a function to find the total number of occurrences of the pattern in a string. Implement the logic using functions.
    • You can implement it using count() or find().

    Prerequisites:

    • Functions

    Objective:

    In this python assignment for beginners the objective is to understand the concept of count() and find()

    Inputs:

    Read 2 strings from the user.

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Emertxe | Bengaluru

    Description:

    • Read 2 words from the user. Write a function to check whether both the words start with the same character or not. 
    • If it starts with the same character return True else return False. 

    Prerequisites:

    • Functions

    Objective:

    To understand the concept of functions

    Inputs:

    Read 2 words from the user.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Read a string with more than one word from the user. Write a function to reverse the order of the words in the string, i.e. print words from R -> L

    Prerequisites:

    • Functions

    Objective:

    To understand the concept of functions

    Inputs:

    Read a string with more than 1 word from the user.

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Emertxe | Bengaluru

    Description:

    • Read elements into the list.  Using lambda and filter() find the elements which are divisible by 13.

    Prerequisites:

    • Lambda

    Objective:

    To understand the concept of lambda and filter()

    Inputs:

    Read elements into th list.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Read strings into the list.  Using lambda and filter() find the string whether it’s palindrome or not. If none of the strings in the list is palindrome then the resultant list should be empty, else the resultant list contain strings which are palindrome.

    Prerequisites:

    • Lambda

    Objective:

    To understand the concept of lambda and filter()

    Inputs:

    Read elements into th list.

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Emertxe | Bengaluru

    Description:

    • Read integer elements into the list. Using lambda and reduce() find min and max elements in the list.

    Prerequisites:

    • Lambda

    Objective:

    To understand the concept of lambda and reduce()

    Inputs:

    Read elements into th list.

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Read 2 integer elements into the list. Write a function to perform division. To check whether the divisor is zero or not, write a decorator and if the divisor is zero, print the error message else print the result of division operation. 

    Prerequisites:

    • Decorators

    Objective:

    In this python assignment for beginners the objective is to understand the concept of Decorators

    Inputs:

    Read 2 integer elements

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    • Read name from the user. Write a function to print a message as “Hello ‘name’ Good morning”. Write a decorator to check if the user has passed the required name or not. If yes, change the message in the decorator as “Hello ‘name’ How are you?” and if not, print the original message which is defined in the function. 

    Prerequisites:

    • Decorators

    Objective:

    To understand the concept of Decorators

    Inputs:

    Read name from the user

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Read elements into 2 arrays. Find the biggest element in each array and print the result.

    Prerequisites:

    • Arrays

    Objective:

    To understand the concept of accessing element in arrays

    Inputs:

    Read elements into 2 different arrays

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    • Read elements into the array. Sort the elements of the array using bubble sort technique and print the result

    Prerequisites:

    • Arrays

    Objective:

    To understand the concept of updating elements in arrays

    Inputs:

    Read elements into arrays

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Read elements into the array and key element which need to be searched in the array.
    • Compare key element with all the elements in the array using linear search technique. If found, print “Element found” else print “Element not found”

    Prerequisites:

    • Arrays

    Objective:

    To understand the concept of Comparing elements in arrays

    Inputs:

    Read elements into the array and key element which needs to be searched

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    • Read marks into the array. Find the sum of all elements into the array and find the percentage. You need to print sum and percentage as result

    Prerequisites:

    • Arrays

    Objective:

    To understand the concept of accessingelements in arrays

    Inputs:

    Read marks into the array 

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Read no_of_employees from the user. For each employee read the name, age, emp_id, salary.
    • You need to write a constructor to copy the details of the employee and write a function to display the employee details.

    Prerequisites:

    • Class and objects

    Objective:

    To understand the concept of accessingelements in arrays

    Inputs:

    Read total employees, name, age, emp_id, salary for each employee

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bangalore | Emertxe

    Description:

    • Write a class with 2 attributes(owner and balance). In this assignment you need to maintain a bank account where 2 operations need to be done repeatedly. First one is “deposit” and the other operation is “Withdraw”.
    •  If the user selects the withdrawal operation, then you need to check whether the owner has sufficient bank balance or not. 

    Prerequisites:

    • Class and objects

    Objective:

    In this python assignment for beginners the objective is to understand the concept of accessing class attributes

    Inputs:

    Read owner name and initial balance.  

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners

    Description:

    • Create a class named “Book”. Create two objects of the same class and write a constructor to copy the value into the class attribute. Here value indicates number of pages in the book. You need to find the sum of the pages of 2 books by adding two objects of the class. 

    Prerequisites:

    • Class , objects and Inheritance

    Objective:

    To understand the concept of operator overloading

    Inputs:

    Read number of pages of 2 books  

    Sample Execution / Output:

    Test Case :

    Embedded Systems Course | Bengaluru | Emertxe

    Description:

    • Create a class named “Student”. Create two objects of the same class and write a constructor to copy the value into the class attribute. Here value indicates marks of the student. You need to find the student who got the highest marks using the Magic method. 
    • Magic method is used to perform the comparison between 2 objects of the class.

    Prerequisites:

    • Inheritance and Polymorphism

    Objective:

    In this python assignment for beginners the objective is to understand the concept of Magic method

    Inputs:

    Read marks of 2 students

    Sample Execution / Output:

    Test Case :

    Python Assignments for beginners
    Q