Ticker

6/recent/ticker-posts

TCS IRA PYTHON 28TH FEB 2022 QUESTION AND SOLUTION

 HELLO DORAEMONS,
IN THIS BLOGPOST ,I HAVE SHARED THE RECENTLY ASKED PYTHON QUESTION AND SOLUTION WHICH IS CERTAINLY USEFUL WHEN YOU WANT TO PRACTICE.HOPE THIS BLOG IS USEFUL TO YOU.



Write the code to define a class to create Ticket objects with the below attributes: 

• id of the ticket, each ticket will have unique id 

• name of the owner, who has raised the ticket 

• sla of the ticket, the time in hours within which the ticket needs to be solved
 
• ticket status, the status of the ticket 

• ticket priority, represents the priority 
 
Define a method in the class which takes values for ticket id, owner name, sla of the ticket as arguments in the given sequence and sets the value of attributes to parameter values passed when an object is created. For the ticket status and ticket priority attributes, default values "open" and "None" are assigned respectively.

Write the code to define a class to create Ultimatix objects with the below attributes: 
• A List having Ticket objects Define a method in the class which takes parameter as described above. The method should set the value of attribute to parameter value while creating  an object. Define a second method inside the Ultimatix class ALL Method will set a value for the ticket priority attribute of all Ticket objects in the List of Tickets of Ultimatix class based on the criteria mentioned below: .

• If the sla of the ticket is less than 3 then the priority will be set to High.

• If the sla of the ticket is greater than or equal to 3 and less than 5 then the priority will be set to Medium 

• If the sla of the ticket is greater than or equal to 5 and less than or equal to 10 the priority will be set to Low.

Define a third method in the class Ultimatix. This method will take as input a string representing a priority value (low/high/...). Method will update the status of all the Tickets in the list of Tickets of the Ultimatix class to "closed" which have the value for ticket priority equal to the value passed as argument. Method will return a number representing the count of Tickets updated if it updates the status of any Ticket in the list to "closed". Otherwise, it will return None.

Note: All searches/string comparisons should be case insensitive. Language You can use/refer the below given sample input and output to verify your solution using' Test against Custom Input 'option in Hackerrank.
 
ALL Note: In Python None means NULL Object. Instructions to write main section of the code

 a. You would require to write the main section completely, hence please follow the below instructions for the same. 

b. You would require to write the main program which is inline to the "sample input description section" mentioned below and to read the data in the same sequence. 

c. Create the respective objects (Ticket and Ultimatix) with the given sequence of arguments to fulfil the __init_method requirement defined in the respective classes referring to the below instructions.

 i. Create a List of Ticket Objects.
To create the list: 
a. Read the count of Ticket objects you want to create. 
b. Create a Ticket object after reading the data related to it and add the object to the list of ticket objects which will be provided to the Ultimatix object. This point repeats for the number of ticket objects (considered in the first line of input, point #c.i.a)

 ii. Create Ultimatix object by using the List of Ticket obiects created (created as mentioned in above Test value to be passed as argument to the third  method of the Ultimatix class. 
e. Call the second
method defined in the Ultimatix class from the main section! f. Display the Ticket Id and the Priority value of all Ticket objects in the list of Tickets of the Ultimatix object created in point call above. While printing the value
• Ticket Id and Priority values should be separated by a blank space. The Ticket Id and Priority values for each ticket should be printed in a separate line. For ticket objects in the list, the values should be printed in ascending order of Ticket Id. For priority values, the first character of the value should be in uppercase and rest of the characters should be in lowercase. 

 g. Call the third method defined in the Ultimatix class by passing the string read in point d. If the value returned by the method is not None, display the value for ticket id and ticket status of all the Tickets in the list of Tickets of the Ultimatix object created in point c.ii. Otherwise, display the message "Oops.. No records found!" excluding! the quotes While printing the values: Language: Python 1 Enter your . Ticket id and ticket status values should be separated by a blank space. The ticket id and ticket status values for each ticket should be printed in a separate line. For ticket objects in the list, the values should be printed in ascending order of Ticket Id. For ticket status values, the first character of the value should be in uppercase and rest of the characters should be in lowercase. Please refer to the sample inputs/outputs for more clarity on input-output formats.

Sample 1:

 Input: 

4

Edward 
3
4
Firoz 
2
3
Jeenat
1
2
Thomas
1
High

Output: 
 
1 Medium 
2 High 
3 High 
4 High 
1 Open 
2 Closed 
3 Closed 
4 Closed 

Sample 2: Input: 

4
1
Edward 
3
2
Thomas 
1
3
Jeenat
1
4
 Firoz 
2
Low

Output: 

1 Medium 
2 High 
3 High 
4 High

Oops.. No records found!

IF YOUR CONFUSED AND DON'T KNOW HOW TO SOLVE THIS QUESTIONS. REFER TO THE BELOW VIDEO.I HAVE GIVEN DETAILED STRUCTURE TO FOLLOW AND EASIEST WAY TO SOLVE THIS QUESTION.

TCS IRA 28TH FEB PYTHON SOLUTION:



HOPE THIS IS HELPFUL TO YOU GUYS.IF YOU LIKE MY WORK ,CONSIDER SUBSCRIBING TO MY CHANNEL AND FOLLOW MY BLOGPOST FOR MORE UPDATES.

Post a Comment

0 Comments