Python Forum
How to append at a specific position
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to append at a specific position
#6
Documentation from python.org:

built-in function zip(),
string method str.join(),
conditional expressions,
generator expression

Python is so concise that expressing it in spoken language is much longer and complicated:

(char if char == guess else star for char, star in zip(password, display))

"generate character if character is equal to guess else generate star for every character - star pair in zipped password and display",

''.join

"join generated chars and stars into string"

display =

Assign value of newly generated string to display (required if one want to repeat the operation)
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
How to append at a specific position - by Carson147 - Sep-21-2019, 12:09 AM
RE: How to append at a specific position - by perfringo - Sep-21-2019, 05:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to append a value to specific excel cell using openpyxl hobbyist 0 4,864 Mar-05-2021, 07:14 PM
Last Post: hobbyist
  Printing string at specific position on terminal - not showing __Mathieu__ 1 2,394 Sep-07-2020, 10:32 AM
Last Post: Larz60+
  Cant Append a word in a line to a list err "str obj has no attribute append Sutsro 2 2,605 Apr-22-2020, 01:01 PM
Last Post: deanhystad
  Delete specific lines contain specific words mannyi 2 4,146 Nov-04-2019, 04:50 PM
Last Post: mannyi
  [split] How to write at a very specific position of a text file Lalit 1 4,049 Feb-01-2018, 04:44 PM
Last Post: dalwood

Forum Jump:

User Panel Messages

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