Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions