Robotics & Artificial Intelligence
Write a program that inputs two tuples and creates a third one that contains all the elements of the first tuple followed by all the elements of the second tuple.
Python Control Flow
1 Like
Answer
tuple1 = eval(input("Enter first tuple: "))
tuple2 = eval(input("Enter second tuple: "))
tuple3 = tuple1 + tuple2
print("First tuple:", tuple1)
print("Second tuple:", tuple2)
print("Combined tuple:", tuple3)Output
Enter first tuple: (1, 2, 3)
Enter second tuple: (4, 5, 6)
First tuple: (1, 2, 3)
Second tuple: (4, 5, 6)
Combined tuple: (1, 2, 3, 4, 5, 6)
Answered By
2 Likes
Related Questions
Write a python program to print a pyramid using 'for' loop.
Write a program to store marks of your class students and show their percentage.
Write a program to implement a simple shopping cart system. In it user can add items, remove items, view the cart, and calculate the total cost.
Write a program to print the longest word in the given list of words.