हिंदी

Create the following NumPy arrays: A 1-D array called vowels having the elements ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’.

Advertisements
Advertisements

प्रश्न

Create the following NumPy arrays:

A 1-D array called vowels having the elements ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’.

कोड लेखन
Advertisements

उत्तर

A 1-D NumPy array called vowels containing the elements 'a', 'e', 'i', 'o' and 'u' can be created as follows:

import numpy as np
vowels = np.array(['a', 'e', 'i', 'o', 'u'])
print(vowels)

Output:

['a' 'e' 'i' 'o' 'u']

Thus, vowels is a 1-D NumPy array containing the five vowel elements.

shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: Introduction to NumPy - Exercise [पृष्ठ ११३]

APPEARS IN

एनसीईआरटी Informatics Practices [English] Class 11
अध्याय 6 Introduction to NumPy
Exercise | Q 4. b) | पृष्ठ ११३
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×