Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Assignment 1 you wrote a Python program that circularly shifted a string by n positions. Consider a string s that is a circularly shifted

In Assignment 1 you wrote a Python program that circularly shifted a string by n positions. Consider a string s that is a circularly shifted version of the letters of the alphabet 'ABCDEFGHIJKLMNOPQRSTUVWXYZ':

s n (number of positions shifted from 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ABCDEFGHIJKLMNOPQRSTUVWXYZ 0
BCDEFGHIJKLMNOPQRSTUVWXYZA 1
CDEFGHIJKLMNOPQRSTUVWXYZAB 2
DEFGHIJKLMNOPQRSTUVWXYZABC 3
EFGHIJKLMNOPQRSTUVWXYZABCD 4
and so on up to 25

In the module question1.py, write a function get_n(s) that has as input a string s that is a circularly shifted version of the letters of the alphabet 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' and returns the number of positions that the string is shifted by (i.e., given a string from the left column of the table above, the function returns the value in the right column).

There are several different ways to solve this problem, but the most obvious is to find the index of the 'A' in the string which Assignment 1 showed you how to do.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions

Question

explain the differnce between horizontal and vertical analysis

Answered: 1 week ago