Create a tuple with different data types and access elements:
Create a tuple with different data types and access elements:
SOLUTION .
# Taking dynamic input for a tuple
num = int(input("Enter an integer: "))
text = input("Enter a string: ")
decimal = float(input("Enter a floating-point number: "))
boolean = input("Enter a boolean value (True/False): ").strip().lower() == "true"
# Creating a tuple with different data types
data = (num, text, decimal, boolean)
# Accessing the second element
print("The second element is:", data[1])