preloader
  • Home
  • Python Programming

Python Programming

  • DURATION

    1 Semester

  • WEEKLY

    Will be Updated

  • FEE

    Will be Updated

About Course

Course Syllabus
Problems
Problem 1

Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal’s total cost. Round the result to the nearest integer.

Sample Input 12.00 20 8

Sample Output 15

Problem 2

Given set S = {1, 2, 3, . . . ,N}. Find two integers, A and B (where A < B), from set S such that the value of A&B is the maximum possible and also less than a given integer, K. In this case, & represents the bitwise AND operator.

Sample Input 3 5 2 8 5 2 2

Sample Output 1 4 0

Problem 3

You will be given an integer n, and a threshold k. For each number i from 1 to n, find the maximum value of logical and , or and xor when compared against all integers through n that are greater than i. Consider a value only if the comparison returns a result less than k.

Sample Input 0 5 4

Sample Output 0 2 3 3

Problem 4

Complete the getGrade(score) function in the editor. It has one parameter: an integer, score, denoting the number of points Julia earned on an exam. It must return the letter corresponding to her grade according to the following: If 25 < score ≤30, then grade A If 20 < score ≤ 25, then grade B If 15 < score ≤ 20, then grade C If 10 < score ≤ 15, then grade D If 5 < score ≤ 10, then grade E If 0≤ score ≤5, then grade F.

Sample Input 0 11

Sample Output 0 D

Problem 5

Ramesh went to a bookshop to buy books. There is a list of books with their value and price. Now Ramesh has limited money but he wants maximum value possible. Now there are 2 kinds of books, one is denoted with 1, that is independent, another one is denoted as 2, which you have to buy in double, that means you can not buy a single or odd number of those books. Print the maximum value Ramesh can extract from the books.

Sample Input: 5 20 1 3 7 0 3 9 10 1 2 4 3 1 7 3 2 0 22 7 7 0

Sample Output: 20

Problem 6

Given a string, S, of length N that is indexed from 0 to N-1, print its even indexed and oddindexed characters as two space-separated strings on a single line.

Sample Input 2 Hacker Rank

Sample Output Hce akr Rn ak

Problem 7

There is an id code that is supposed to be given to all the aspirants of an exam. It is actually a substring of a given string. That means, the authority takes a string and then assigns all the unique substrings to all the students.

Sample Input: Abdc

Sample output: dc

Problem 8

Raman was playing a game, he starts with x coins. Now in every step, he wins and loses and he has to get the money or pay the money as needed. He came in contact with a psychic who can see the future and the Psychic predicted the outcomes after each step. Now Raman wants to start the game with the minimum wage where he doesn’t run out of money. Help Raman to find what money he should start with. The only rule to keep playing is not going in a credit situation.

Sample Input: 4 2 -9 15 2

Sample Output: 7

Problem 9

The user enters a string and a substring. You have to print the number of times that the substring occurs in the given string. String traversal will take place from left to right, not from right to left.

Input Format The first line of input contains the original string. The next line contains the substring.

Constraints 1 <= len(string) <= 200 Each character in the string is an ascii character.

Output Format Output the integer number indicating the total number of occurrences of the substring in the original string.

Sample Input 0 ABCDCDC CDC

Problem 10

Repeating Characters Problem Statement – Cod is given a string and he thinks the letters that are repeated do have more power. He gathers only the repeating characters and keeps them as the most powerful to least powerful manner. Now it is your turn to write a code that will help Codu to do that. Note that: only lowercase alphabets are accepted in input. Input Format: A string in a single line

Output Format: A string made of only the repeated characters as sorted their frequency reducin, if the same the lower ascii value comes before.

Constraints: Length of string<=10^5

Sample Input: Abcdefghaabca

Sample Output: abc

Problem 11

Amit is a salesman who wishes to know the maximum revenue received from a given item of the N products each day . Amit has a sales record of N products for M days. Help Amit to find the highest revenue received each day. Sample Testcases : Input: 3 4 101 123 234 344 143 282 499 493 283 493 202 304

Output: 344 499 493

Problem 12

You are in-charge of the cake for a child’s birthday. You have decided the cake will have one candle for each year of their total age. They will only be able to blow out the tallest of the candles. Count how many candles are tallest.

Sample Input 0 4 3 2 1 3

Sample Output 0 2

Problem 13

Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order. The same number may be chosen from candidates an unlimited number of times. Two combinations are unique if the frequency of at least one of the chosen numbers is different.

Input: candidates = [2,3,6,7], target = 7

Output: [[2,2,3],[7]] 2 and 3 are candidates, and 2 + 2 + 3 = 7. Note that 2 can be used multiple times. 7 is a candidate, and 7 = 7. These are the only two combinations.

Input: candidates = [2,3,5], target = 8

Output: [[2,2,2,2],[2,3,3],[3,5]]

Input: candidates = [2], target = 1

Output: []

Problem 14

You are given two sets, A and B. Your job is to find whether set A is a subset of set B. If set A is subset of set B, print True, else print False.

Sample Input 3 5 1 2 3 5 6 9 9 8 5 6 3 2 1 4 7 1 2 5 3 6 5 4 1 7 1 2 3 5 6 8 9 3 9 8 2

Sample Output True False False

Online Resources

References

  • Python Programming 2nd edition by Reema Thareja Publisher by Oxford University Press
  • Python Programming 3rd edition by John M Zelle publisher by Ingram short title
Faculty

Other Courses

DEVOps
  • 28 hours
  • Certification

DEVOps

About Course DevOps course syllabus spans several topics which are considered vital for the …

Know More
Data Structures and Algorithms
  • 2 Semesters
  • Technical Campus Recruitment Training

Data Structures and Algorithms

About Course It has all the required topics in one place to prepare technical interview and written …

Know More
 VERBAL ABILITY
  • III/IV Semester
  • Technical Campus Recruitment Training

VERBAL ABILITY

About Course The Main Purpose of this course is to enhance Verbal ability skills that are vital for …

Know More