Question: Write a python program that asks the user to input a string and a number. Your program should print only the characters of the string

Write a python program that asks the user to input a string and a number. Your program should print only the characters of the string at indices that are divisible by the number. Sample Input 1: abcdefghi 3 Sample Output 1: adg Explanation: The characters at indices 0, 3, and 6 (which are divisible by 3) are a, d, and g respectively Sample Input 2: 12345678 1 Sample Output 2: 12345678 Explanation: All indices are divisible by 1, so the entire string is printed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
