Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Strict Sentence


A sentence is called Strict sentence if it contains all unique words.You can make a sentence strict by removing some words from it such that all remaining words are unique.


You are given a sentence S. You need to write a program to make it strict and print the longest strict sentence possible(Order of words in the given sentence should be preserved).


Note: Words are case-insensitive. For example, Apple, apple, aPPle etc.. are considered the same word.


Input

The first line contains a string S.


Output

The output contains a string which is the longest strict sentence possible.


Explanation

For S = my name is usha my native place is hyderabad.


my and is are not unique words.After removing my and is, the longest possible strict sentence is my name is usha native place hyderabad. So the output should be my name is usha native place hyderabad.


Sample Input1

my name is usha my native place is hyderabad

Sample Output1

my name is usha native place hyderabad




Midterm Questions-checkpoint.ipynb


Midterm Questions-checkpoint.ipynb_


𝗤𝘂𝗲𝘀𝘁𝗶𝗼𝗻 1


As you are a student of university now, you need to ensure your assignments


are plagiarism-free. To do this, you decide to design a simple plagiarism


checker. Your checker will take 2 strings as input. Then it will compare


the 2 strings and check how many words they have in common. Then, print the


percentage in common, by calculating:



(No. of words in common / (No of words in string 1 + No of words in string 2)) * 100.



If the calculated plagiarism is greater than or equal to 30%,


print “Plagiarism detected.” Otherwise, print “Good job!”.



Note: you need to compare “words” not individual characters. You can


consider that all characters in both inputs will be in only lowercase or


uppercase.

6. Write a Python program that reads a number and finds the sum of the series of 1 +11 + 111 + 1111 + ….+N terms. 

===================================================== 

Sample Input1

Sample Output1: 

1 + 11 + 111 + 1111 + 11111 

The Sum is: 1234




4. Write a Python program to Capitalize the first character of each word in a String [You cannot use the built-in upper() function]

Sample Input: 

I love python programming 

Sample Output: I Love Python Programming


2. Write a Python program to find the largest and smallest word in a string. 

[you are not allowed to use max() and min()]

Sample Input

It is a string with the smallest and largest word. 

Sample Output

The largest word is “smallest” and the smallest word is 'a'.





you are given a undireevted tree with n nodes numbered from 0ton-1 each node has a value represented by the array arr of length n you have to divode this tree into two components by removing a single edge moreover you need to ensure the bitwise and of both trees obtained is same find total number of ways to divide the given tree


3. Write a program using function to calculate the simple interest. Suppose the customer is a senior citizen. She is being offered 15 percent rate of interest; he is being offered 12 percent rate of interest for all other customers, the ROI is 10 percent.

Sample Input:



Enter the principal amount: 200000 Enter the no of years: 3

Gender (m/f): m

Is customer senior citizen (y/n): n Sample Output:


- Create a class Book and initialize it with title, author, and price.

- Create a magic method __eq__, the __eq__ method will check the equality between two objects 

- Create a magic method __ge__, the __ge__ method will check >= relationship with another object. (Only comparing the price attribute) 

- Create a magic method __lt__, the __lt__ method will check < relationship with another object. (Only comparing the price attribute) 

- In all above three magic methods we are comparing two different objects of same class, we need to check / verify here if those objects are from the same class. In all above three magic methods use built-in method isinstance to verify / check if the other object is of same class.


Provide your own examples of the following using Python lists. Create your own examples. Do not copy them from another source. 

  • Nested lists 
  • The “*” operator 
  • List slices 
  • The “+=” operator 
  • A list filter 
  • A list operation that is legal but does the "wrong" thing, not what the programmer expects 

Provide the Python code and output for your program and all your examples. 


Write a python program that takes a string as an input from the user and then modifies the string in such a way that the string always starts with an uppercase letter and the case of each subsequent letter is the opposite of the previous letter (uppercase character followed by a lowercase character followed by an uppercase character and so on). Finally the modified string is printed to show the user.


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS