I have a program that takes a string input, and an integer input. The integer determines 2 things, how many times the string is printed, and which character in the string is visible, otherwise replaced by "."
For example - String: Hello World Integer: 3
Should show as:
H..l..W..l.
.e..o..o..d
..l.. ..r..
Basically printing diagonal text.
How would I go about having every 3rd character in the string shown, otherwise replaced by "."? Regardless of the inputted string and beginning with the first.
I only need the function, I got the rest of the code.
The code so far to is this (not compact):
stringVar = input("String: ")
countVar = input("Count: ")
countInt = int(countVar)
stringInt = len(stringVar)
if countInt > stringInt:
print("Number should be between 1 and the lenght of the string!")
exit()
if countInt < 1:
print("Number should be between 1 and the lenght of the string!")
exit()
count = 1
while count <= countInt:
print(stringVar)
count = count + 1
I just need a way to also replace the characters in StringVar.