1.What is a variable
A variable can be a empty container in which we can store some data.
2.Points to remember while declaring a variable
- The variable name may start with a underscore or a letter.
-
It can not start with a digit or a symbol. For example-7,4,%,!,?,etc.
-
Variable can only contain letters, underscores, or a digit after a digit. For example-a=10
a_2=12,etc.
3.Examples
1.
num1_list1=['science', 'history', 'mathematics']
print(num1_list1)
Enter fullscreen mode Exit fullscreen mode
Output:
[‘science’, ‘history’, ‘mathematics’]
2.
_123=("dev community")
print(_123)
Enter fullscreen mode Exit fullscreen mode
Output:
dev community
3.
foo="Hello"
print(foo)
Enter fullscreen mode Exit fullscreen mode
Output:
Hello
4.
my_tuple = (1, 2, 3, 4)
print (len(my_tuple))
Enter fullscreen mode Exit fullscreen mode
Output:
4
© 版权声明
THE END
暂无评论内容