-
[email protected] wrote a new item 2 years, 4 months ago
my_tuple = (‘sara’, 6, 5, 0.97) my_list = [‘sara’, 6, 5, 0.97] print(my_tuple[0]) # output => ‘sara’ print(my_list[0]) # output => ‘sara’ my_tuple[0] = ‘ansh’ # modifying tuple => throws an […]
-
[email protected] wrote a new item 2 years, 4 months ago
A local scope refers to the local objects available in the current function. A global scope refers to the objects available throughout the code execution since their inception. A module-level scop […]
-
[email protected] wrote a new item 2 years, 4 months ago
Use a tuple to store a sequence of items that will not change. Use a list to store a sequence of items that may change. Use a dictionary when you want to associate pairs of two items.
-
[email protected] wrote a new item 2 years, 4 months ago
Global Variables: Variables declared outside a function or in a global space are called global variables. These variables can be accessed by any function in the program. Local Variables: Any variable d […]
-
[email protected] wrote a new item 2 years, 4 months ago
The number by default are interpreted as a decimal and if it is represented by int(‘0x1’) then it gives an error as ValueError. In this the int(string,base) the function takes the parameter to convert string t […]
