Python Forum
reach the elements in the list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
reach the elements in the list
#8
(Oct-04-2017, 07:19 PM)ichabod801 Wrote: No, you convert the whole number to a string. Then you can access the individual digits with slices, like i[1]. You just need to convert those individual digits back to integers with int().

barkod_numarasi=input("barkod numarası girelim")
kac_tekrar=input("kaç tekrar olsun")

while True:
    if not barkod_numarasi:
        print("boş bırakılamaz")
        break
    elif len(barkod_numarasi) < 7 or len(barkod_numarasi) > 7:
        print("barkod numarası 7 'den küçük olamaz")
        break
    else:
        print("şimdi hesaplanıyor..")
        liste = [str(i) for i in range(int(barkod_numarasi), int(barkod_numarasi) + int(kac_tekrar))]
        for i in liste:
            print(int(i[6]))

        break
barkod numarası girelim1234567
kaç tekrar olsun2
şimdi hesaplanıyor..
7
8
hey.. it's working..thank you so much. Doh Big Grin Blush
Reply


Messages In This Thread
reach the elements in the list - by ptah - Oct-03-2017, 03:32 PM
RE: reach the elements in the list - by nilamo - Oct-03-2017, 03:54 PM
RE: reach the elements in the list - by ptah - Oct-04-2017, 10:05 AM
RE: reach the elements in the list - by ichabod801 - Oct-03-2017, 04:19 PM
RE: reach the elements in the list - by ichabod801 - Oct-04-2017, 01:27 PM
RE: reach the elements in the list - by ptah - Oct-04-2017, 06:57 PM
RE: reach the elements in the list - by ichabod801 - Oct-04-2017, 07:19 PM
RE: reach the elements in the list - by ptah - Oct-04-2017, 08:12 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  help with adding duplicates elements together in a list 2ECC3O 5 2,105 Sep-10-2022, 07:11 AM
Last Post: 2ECC3O
  Unexpected behavior accessing list elements. tonyflute 2 2,292 Apr-09-2021, 02:36 PM
Last Post: tonyflute
  How to find difference between elements in a list? Using beginner Basics only. Anklebiter 8 4,394 Nov-19-2020, 07:43 PM
Last Post: Anklebiter
  Get 5 most unique combinations of elements in a 2D list wanttolearn 1 2,331 Sep-24-2020, 02:26 PM
Last Post: buran
  Loop through elements of list and include as value in the dictionary Rupini 3 2,679 Jun-13-2020, 05:43 AM
Last Post: buran
  How can I print the number of unique elements in a list? AnOddGirl 5 3,317 Mar-24-2020, 05:47 AM
Last Post: AnOddGirl
  Extracting elements in a list to form a message using for loop Tony04 2 2,387 Oct-25-2019, 05:55 PM
Last Post: ichabod801
  Sum of elements on the list recursive sev 3 2,591 Jun-20-2019, 02:14 PM
Last Post: sev

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020