Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#Write a function called align_right. align_right should #take two parameters: a string (a_string) and an integer #(string_length), in that order. # #The function should return

image text in transcribed

\#Write a function called align_right. align_right should \#take two parameters: a string (a_string) and an integer \#(string_length), in that order. \# \#The function should return the same string with spaces \#added to the left so that the text is "right aligned" in a \#string. The number of spaces added should make the total \#string length equal string_length. \# \#For example: align right("CS1301", 10) would return the \#string "CS1301". Four spaces are added to the left so \#"CS1301" is right-aligned and the total string length is #10. # \#HINT: Remember, len(a_string) will give you the number of \#characters currently in a_string. \#Add your function here! \#Below are some lines of code that will test your function. \#You can change the value of the variable(s) to test your \#function with different inputs. \# \#If your function works correctly, this will originally \#print:" CS1301" print(align_right("CS1301", 10))

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions

Question

How does the law define the occupier of property?

Answered: 1 week ago