Robotics & Artificial Intelligence
Write a Python program to declare and print 'list', 'dictionary', and 'tuple'.
Getting Started
3 Likes
Answer
# Declaring a list
my_list = [10, 20, 30, 40]
print("List:", my_list)
# Declaring a dictionary
my_dict = {"Name": "Amit", "Age": 15, "City": "Delhi"}
print("Dictionary:", my_dict)
# Declaring a tuple
my_tuple = (5, 10, 15, 20)
print("Tuple:", my_tuple)Output
List: [10, 20, 30, 40]
Dictionary: {'Name': 'Amit', 'Age': 15, 'City': 'Delhi'}
Tuple: (5, 10, 15, 20)
Answered By
2 Likes
Related Questions
What do you understand by data type? List names of Python built-in data types.
What is the difference between list and tuple in Python? Explain with the help of an example.
Write a Python program to demonstrate use of string operators.
Why indentation in Python is important? Explain with the help of an example.