Write program/code for below input to get required output.

0 votes

Write program/code for below input to get the required output

Input

str1= abcde

str2= abret

Output: "rcdt"

Please help me to solve this

Oct 6 in Python by Roshni
• 6,190 points
45 views

1 answer to this question.

0 votes

That is a "set subtraction" operation. Use the set data structure for that.

Str1 = {a,b,c,d,e}
Str2 = {a,b,r,e,t}
print Str1 - Str2

Output:

>>> print Str1 - Str2
set([r,c,d,t])
answered Oct 6 by Gitika
• 50,620 points

Related Questions In Python

0 votes
1 answer

Could you please help to write a code for this program

Hello, @Hitesh, You can follow the below: print("List of ...READ MORE

answered Nov 4 in Python by Roshni
• 6,190 points
42 views
+1 vote
1 answer
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,564 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,186 views
0 votes
1 answer

How to write a code In Python where input will be 1 then the output will be 2?

You can go through this:  def num(number): ...READ MORE

answered Oct 6 in Python by Gitika
• 50,620 points
35 views
0 votes
1 answer

How to write a Python code to sort a numerical dataset?

Hi, @Roshni,  The code to sort a numerical ...READ MORE

answered Jun 26 in Python by Gitika
• 50,620 points
92 views