OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

For loop printing on the same line with "-" between every 4 characters [closed]

  • Thread starter Thread starter Mohamed tamer
  • Start date Start date
M

Mohamed tamer

Guest
Image of the code

I'm trying to print a * for every number in Credit_Card all in one line, and a dash between every set of 4 numbers so it prints (****-****-****)

I got the one line figured out with the print, end="" but I would like it to print a dash between each set of 4 numbers so I added print, end="-" but it doesn't work and prints *-*-*-*-*-*-*.
<p><a href="https://i.sstatic.net/EI0v5IZP.png" rel="nofollow noreferrer">Image of the code</a></p>
<p>I'm trying to print a <code>*</code> for every number in <code>Credit_Card</code> all in one line, and a dash between every set of 4 numbers so it prints (<code>****-****-****</code>)</p>
<p>I got the one line figured out with the <code>print</code>, <code>end=""</code> but I would like it to print a dash between each set of 4 numbers so I added <code>print</code>, <code>end="-"</code> but it doesn't work and prints <code>*-*-*-*-*-*-*</code>.</p>
 

Latest posts

Top