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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!