#27 Python Tutorial for Beginners | Array values from User in Python | Search in Array

///#27 Python Tutorial for Beginners | Array values from User in Python | Search in Array

#27 Python Tutorial for Beginners | Array values from User in Python | Search in Array

FavoriteLoadingAdd to favorites

Python Tutorial to learn Python programming with examples
Complete Python Tutorial for Beginners Playlist :
Python Tutorial in Hindi :

Github :-

In this video we will see:
– Accepting values from user and store them in Array in python
– Creating blank array
– Asking length of array from user and accepting the values
– Printing index of array value manually
– Printing index value of user entered value
– Printing index of array value by function

Editing Monitors :

Check out our website:

Follow Telusko on Twitter:

Follow on Facebook:
Telusko :
Navin Reddy :

Follow Navin Reddy on Instagram:

Subscribe to our other channel:
Navin Reddy :
Telusko Hindi :

Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20

source

By |2020-09-08T09:21:51+00:00September 8th, 2020|Python Video Tutorials|38 Comments

38 Comments

  1. Yash Sharma September 8, 2020 at 9:21 am - Reply

    i see everyone using in built function even though assignment says no to those, this is the best answer i could find for the first question
    from array import *

    arr = array('i',[5,10,22,54,6])

    arr = [ e for e in arr if e != arr[2]]

    print(arr)

  2. hypothesis williams September 8, 2020 at 9:21 am - Reply

    hey ,telusko i want to know that why my command of import all functions from python doesnt work on replit

  3. Anoop Tiwari September 8, 2020 at 9:21 am - Reply

    Assignment
    Q 1. To create array with 5 elements and delete element with index value 2.
    Q2a) reversing a array without using inbuilt function .b) Creating new array with reversing of existing array

  4. mehdi sayf September 8, 2020 at 9:21 am - Reply

    assignment question:
    1-create an array with 5 values and delete the value at index number 2 without using in-built function
    2-write a code to reverse an array without using in-built function

  5. dheeru bhai September 8, 2020 at 9:21 am - Reply

    but one thing sir….
    telusko logo and the next video or next series promotions covers the assignment content plz try to uncover it sir…

  6. dheeru bhai September 8, 2020 at 9:21 am - Reply

    sir ur python series is the best that i could find on youtube…
    may be because of ur clear cut explanation or the way u teach…
    sir please bring us with more series in 2020 to improve ourselves and tq somuch for this series sir…

  7. Sh. Hafeez September 8, 2020 at 9:21 am - Reply

    Hi Guys,
    Can somebody help?
    While I m searching for index of the value always getting 0 , Following is my code and results:
    from array import*
    arr = array('i', [])
    n = int(input("Enter the length of thr array"))
    for i in range(n):
    x = int(input("Enter the next value"))
    arr.append((x))
    print(arr)
    # If need to know the index of the value
    val = int(input("Enter the value for search"))
    k = 0
    for e in arr:
    if e == val:
    print(k)
    break
    k+1

    Result:
    Enter the length of thr array4
    Enter the next value56
    Enter the next value34
    Enter the next value23
    Enter the next value67
    array('i', [56, 34, 23, 67])
    Enter the value for search23
    0

  8. Samrudh Raja September 8, 2020 at 9:21 am - Reply

    It is impossible to see the assignment questions

  9. Samrudh Raja September 8, 2020 at 9:21 am - Reply

    Sir the end screens are covering the assignments

  10. Dhruv Dutt September 8, 2020 at 9:21 am - Reply

    •Advice for those who are not able to see questions at last due to channel logo:-

    U can just let the video end and turn of auto play option from youtube settings , at last after the video ends you will be able to see questions easily (simple)….

  11. Dhruv Dutt September 8, 2020 at 9:21 am - Reply

    Question 01:-

    from array import *
    a=array('i',[3,4,5,6,7])

    for i in range (5):
    if i==2:
    continue
    else:
    print(a[i])

    🎯Output:-
    3
    4
    6
    7

    [Program finished]

  12. Bipin C September 8, 2020 at 9:21 am - Reply

    Reverse an array program
    from array import *
    Arr=array('i',[1,2,3 ,4])
    new=array(Arr.typecode,(Arr[-i] for i in Arr))
    print(new)

  13. vernanonix September 8, 2020 at 9:21 am - Reply

    #1. Create an array with 5 values and delete the value at index number 2 without using in-built functions.

    from array import *

    arr=array("i",[13,14,15,16,17])

    print(arr)

    del arr[2]

    print(arr)

    #2. Write a code to reverse an array without using in-built functions.

    rev=array(arr.typecode,[])

    for i in range(len(arr)):

    rev.append(arr[len(arr)-i-1])

    print(rev)

  14. Bha Vani September 8, 2020 at 9:21 am - Reply

    Really very useful good video👍👍👍👍👍

  15. Monu Chauhan September 8, 2020 at 9:21 am - Reply

    val=int(input('enter the value'))

    for i in range(n):

    if val==arr[i]:

    print(i)

    break

  16. motukoori sai murari September 8, 2020 at 9:21 am - Reply

    why is i included inside array

  17. ruba yousif September 8, 2020 at 9:21 am - Reply

    The way you say "bye bye" 😂😂

  18. Manikanta September 8, 2020 at 9:21 am - Reply

    2nd solution
    from array import *

    arr = array('i',[])

    n = int(input("Enter the length of the array"))

    for i in range(n):

    x = int(input("Enter the next element"))

    arr.append(x)

    print(arr)

    arr.reverse()

    print(arr)
    1st solution
    from array import *

    arr = array('i',[])

    n = int(input("Enter the length of the array"))

    for i in range(n):

    x = int(input("Enter the next element"))

    arr.append(x)

    print(arr)

    arr.pop(2)

    print(arr)

  19. Muzammil Parvez M September 8, 2020 at 9:21 am - Reply

    from array import *

    arr =array('i',[])

    n = int(input("enter the length of array"))

    for i in range(n):

    x = int(input("enter the next value"))

    arr.append(x)

    print(arr)

    val = int(input("enter the value to search"))

    k = 0

    for e in arr:

    if e==val:

    print(k)

    break

    K+=1

    for all search value its giving index value as '0' only
    kindly provied a solution

  20. SHYAM SUNDAR JAISWAL September 8, 2020 at 9:21 am - Reply

    Sir suppose we have students name and his roll no. Our task is that by searching name find corresponding roll no. How to do that??

  21. H2O September 8, 2020 at 9:21 am - Reply

    is there a way when you are trying to get index number from search instead of using k and incrementing this extra step why not getting index number from the iteration that matches the i == vals : so it could print index of the searched up value.

  22. Mr. Kishan Jaycker September 8, 2020 at 9:21 am - Reply

    from array import *

    arr = array('i', [])

    num = int(input("Enter the length of an array "))

    for i in range(num):

    n = int(input("Enter the value "))

    arr.append(n)

    val = int(input("Enter the value for delete "))

    c=0

    for ele in arr:

    if ele == val:

    arr.pop(c)

    break

    c+=1

    print(arr)

  23. Vaibhav Tewani September 8, 2020 at 9:21 am - Reply

    Program no 2
    Arr = array('i', [ ])
    X = inter(input("enter the length of array"))
    i= 1
    For e in range (x+1,1,-1) :
    r =int(input(enter the value ))
    Arr. Append(r)

    For e in range x:
    Print(arr.[ x-i] , end= '')
    i = i + 1

  24. Trojan September 8, 2020 at 9:21 am - Reply

    pls provide the cdes for assignment questions
    +

  25. Ayan Yadav September 8, 2020 at 9:21 am - Reply

    Sir how to take user in put in array in single line?? Like
    1 2 3 4 5

  26. Saurav Narang September 8, 2020 at 9:21 am - Reply

    1st question:

    from array import *

    n = int(input('Enter the Number of Elements in Array= '))

    arr = array('i',[])

    for i in range(n):

    x = int(input('Enter the next value= '))

    if i==2:

    pass

    else:

    arr.append(x)

    print(arr)

    2nd question:

    from array import *

    n = int(input('Enter the Number of Elements in Array= '))

    arr = array('i',[])

    for i in range(n):

    x = int(input('Enter the next value= '))

    arr.append(x)

    revarr = array('i',[])

    for j in range(1,n+1):

    revarr.append(arr[-j])

    print(revarr)

  27. anilkumar lucky Lucky September 8, 2020 at 9:21 am - Reply

    from array import *

    arr=array('i',[])

    n=int(input("enter the length of array:"))

    for i in range(n):

    x=int(input("enter the values:"))

    arr.append(x)

    print(arr)

    len(arr)

    vals=int(input("enter the value to search:"))

    for e in range(len(arr)):

    if arr[e]==vals:

    print(e)

  28. atulaya gupta September 8, 2020 at 9:21 am - Reply

    from array import *
    arr1 = array('i',[])
    Len = int(input("Please enter the length of the array:", ))
    for i in range(Len):
    value = int(input("Please enter the value:", ))
    arr1.append(value)

    print(arr1)
    j = 0
    track = int(input("Please enter the number for which index is required:", ))
    while(arr1[j]!=track):
    j = j +1
    print(j)

  29. TAN YUE JUN Moe September 8, 2020 at 9:21 am - Reply

    a quick question on how to know k was define as search numbers? where it has only initialization to zero. It does not tie to search array.

  30. Harshwardhan Singh September 8, 2020 at 9:21 am - Reply

    from array import *

    arr = array('i',[])
    x = int(input("Enter the length of the array you want to create:"))
    for i in range(x):
    y = int(input("Enter the value for the array:"))
    arr.append(y)

    print(arr)

    k = 0

    a = int(input("Enter a value to be searched in arr:"))
    for e in arr:
    if e == a:
    print(k)
    break
    k+=1

    How many of you liked my code? If anyone of you have then please like so that other people could see it.

  31. Aman Das September 8, 2020 at 9:21 am - Reply

    1)
    from array import *

    arr = array('i' , [5,6,7,8,9])

    print(arr)

    k = 0

    for e in arr:

    if k == 2:

    arr.pop(2) # or del arr[2]

    k += 1

    print(arr)

    2)
    from array import *

    ar = array('i' , [])

    n = int(input("Enter the length of the array: "))

    for i in range(n):

    x = int(input("Enter the next value: "))

    ar.append(x)

    print(ar)

    var = ar[-1::-1]

    print(var)

    open to feedback on my code and ways to make it more efficient.

  32. Kishan Kini September 8, 2020 at 9:21 am - Reply

    2] i) Reversing without built-in function:
    from array import *

    arr=array('i',[])

    l=int(input("Enter size: "))

    for i in range(l):

    x=int(input("Enter element: "))

    arr.append(x)

    i=len(arr)

    new_arr=[]

    while(i!=0):

    new_arr.append(arr[i-1])

    i-=1

    print(new_arr)

    ii) Reversing with built-in function:
    new=list(reversed(arr))

    print(new)

  33. Kanta Rajesh September 8, 2020 at 9:21 am - Reply

    # To create array with 5 elements and delete element with index value 2:

    from array import*

    arr = array('i',[11,22,33,44,55])

    print("length of array is:",len(arr))

    print("deleting index 2 value:",arr.pop(2))

    print("after deleting index 2 value:",arr)

    print("length of array is:",len(arr))

  34. It's me Rishi September 8, 2020 at 9:21 am - Reply

    Answer for Q-1 :

    from array import *

    arr = array('i',[1,2,3,4,5])

    length = len(arr)

    a=0

    for i in range(length) :

    if a == 2:

    del arr[a]

    break

    a= a+1

    print(arr)

  35. hồng thương trần September 8, 2020 at 9:21 am - Reply

    1.
    from array import *

    arr = array('i',[])

    n= int(input("Enter the lengh of array"))

    for i in range (n):

    x = int(input("Enter the next value"))

    arr.append(x)

    print(arr)

    for i in range (n):

    if i ==2:

    del(arr[2])

    print(arr)

  36. Prajwal Khed September 8, 2020 at 9:21 am - Reply

    1st solution
    Num =array('i',[2,3,4,5,6,]
    K=0
    For i in num:
    if k==2:
    pass
    else:
    print(i)
    K+=1

  37. Adarsh Gs September 8, 2020 at 9:21 am - Reply

    Q. 1
    From array import*
    X = array("I",[12,34,6,5,8]
    #index of 2 is 6
    ind = 6
    For i in x:
    If I==ind:
    Continue
    Print (i)

  38. jai shivnani September 8, 2020 at 9:21 am - Reply

    #To create an array with 5 elements and delete the element with index value 2
    from array import *

    arr = array('i',[])

    n = int(input("Enter the length of array"))
    for i in range(n):

    x = int(input("Enter the next value"))
    arr.append(x)
    print(arr)

    k = int(input("Enter the index of the value you need to delete"))

    for e in arr:
    del arr[k]

    break
    print(arr)

Leave A Comment

*