Computer Science

Write a program that inputs two tuples seq_a and seq_b and prints True if every element in seq_a is also an element of seq_b, else prints False.

Python

Python Tuples

7 Likes

Answer

seq_a = eval(input("Enter the first tuple: "))
seq_b = eval(input("Enter the second tuple: "))

for i in seq_a:
    if i not in seq_b:
        print("False")
        break
else:
    print("True")

Output

Enter the first tuple: 1,3,5 
Enter the second tuple: 4,5,1,3
True

Answered By

4 Likes


Related Questions