Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Create an array in python 💻

  • Coder Mala
  • 2024-05-03
  • 35
Create an array in python 💻
how to create an array in pythonto access elementsto add elementsto delete elementsto remove elements@Apanacollegeofficial@codewithharry
  • ok logo

Скачать Create an array in python 💻 бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Create an array in python 💻 или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Create an array in python 💻 бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Create an array in python 💻

welcome to my channel we know that in this video how to create an array in python, access elements,add elements and remove elements
Create an array in python 💻#to access #to add#to remove#python #shorts #viral
‪@ApnaCollegeOfficial‬
‪@CodeWithHarry‬
‪@CoderMala‬
This Python code demonstrates the usage of arrays using the `array` module. Here's a breakdown of what each part does:

1. `import array as ar`: Imports the `array` module and renames it as `ar` for easier reference.

2. `arr = ar.array('i', [1, 2, 3, 4, 5, 6])`: Creates an array named `arr` of type 'i' (integer) containing the elements 1, 2, 3, 4, 5, and 6.

3. `print(arr)`: Prints the entire array `arr`.

4. `print(arr[2])`: Accesses and prints the element at index 2 of the array `arr`, which is 3.

5. `print(arr[1])`: Accesses and prints the element at index 1 of the array `arr`, which is 2.

6. `print(arr[1] + arr[2])`: Accesses elements at index 1 and index 2 of the array `arr`, adds them together, and prints the result.

7. `arr.append(7)`: Appends the integer 7 to the end of the array `arr`.

8. `arr2 = ar.array('i', [8, 9, 10, 11, 12, 13, 14, 15])`: Creates another array named `arr2` with integers from 8 to 15.

9. `arr.extend(arr2)`: Extends the array `arr` by appending all elements from array `arr2` to it.

10. `arr2.remove(15)`: Removes the element 15 from the array `arr2`.

11. `arr2.pop()`: Removes and returns the last element from the array `arr2`.

This code illustrates various operations such as creating arrays, accessing elements by index, appending elements, extending arrays, and removing elements.
import array as ar
arr=ar.array('i',[1,2,3,4,5,6])#To create an array
print(arr)#To print an array
print(arr[2])#To access element 3 using index
print(arr[1])#To access element 2 ising index printed
#tTo add elements 2 and 3 using index and printed
print(arr[1]+arr[2])
print("Adding element in existing array :")
#To add single element 7 in existing attay arr
arr.append(7)
print(arr)#To print array
#To create arr2
arr2=ar.array ('i',[8,9,10,11,12,13,14,15])
#To add all elements of arr in existing array arr
arr.extend(arr2)
#To print array
print(arr)
print()
print("Delete element in existing array.")
#To remove single element from existing array aar2
arr2.remove(15)
print(arr2) # to print arr2
#To remove last element of array arr2
arr2.pop()
print(arr2)#To print arr2

Комментарии

Информация по комментариям в разработке

Похожие видео

  • How to create array, modify and all delete elements of array in python program #viral #python #short
    How to create array, modify and all delete elements of array in python program #viral #python #short
    1 год назад
  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]