82.3k views
5 votes
How to print the output of "WELCOME" by using python codes with arrays.

1 Answer

7 votes

Answer:

Following are the code to this question:

arr=['WELCOME']#defining list arr and assign string value

print (str(arr)[2:-2])#use print method that uses slicing to remove bracket and quotes

Output:

WELCOME

Explanation:

The Array data type is used to store the same type of value, but in python, the array is not used, instead of using an array we use the list, that stores multiple data types.

In the above code "arr", that is list is declared, that store a string value.

To print its value, we use the print method, inside this, we use slicing to remove brackets and quotes.

User Yun CHEN
by
3.0k points