a) Write a Python script that defines the string Welcome to Python and performs the following,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
a) Write a Python script that defines the string "Welcome to Python" and performs the following, where each operation must consist of one line of Python code using slicing only: Prints all characters from the 6th to the 10th character. . Prints all characters after the 4th character. Prints the last five characters (without assuming the size). Checks and prints whether a given string s is a palindrome (same in reverse). b) Write a python program/script that creates a list that contains the following countries and capitals: "Istanbul", "Turkey", "Cairo", "Egypt", "Baghdad", "Iraq". "Delhi". "India". "Tehran", "Iran", "Riyadh", "Saudi Arabia", "Ankara", "Turkey"; and performs the following: Prints all items that are cities, i.e. elements at even indices Prints the list in reverse using slicing Finds and replaces elements Delhi and India with Muscat and Oman a) Write a Python script that defines the string "Welcome to Python" and performs the following, where each operation must consist of one line of Python code using slicing only: Prints all characters from the 6th to the 10th character. . Prints all characters after the 4th character. Prints the last five characters (without assuming the size). Checks and prints whether a given string s is a palindrome (same in reverse). b) Write a python program/script that creates a list that contains the following countries and capitals: "Istanbul", "Turkey", "Cairo", "Egypt", "Baghdad", "Iraq". "Delhi". "India". "Tehran", "Iran", "Riyadh", "Saudi Arabia", "Ankara", "Turkey"; and performs the following: Prints all items that are cities, i.e. elements at even indices Prints the list in reverse using slicing Finds and replaces elements Delhi and India with Muscat and Oman
Expert Answer:
Answer rating: 100% (QA)
define the string welcomestringWelcome to Python we use the strlowhigh notation to slice strings and ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Same facts as in above example no . 5 with this additional information. Maria s $ 1 0 0 , 0 0 0 basis in her LLC interest included a $ 1 2 0 , 0 0 0 share of the LLC s liabilities. Rather than a cash...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Labour unions have no interest in the financial statements of private company. Select one: O True False Identify the most relevant transaction for this entry: Assets +12 000 Select one: O True False...
-
which you describe and reflect on one of your favorite pop culture artifacts. Your goals will be simple: you will describe in detail a popular film, tv show, ad campaign, performer, song,...
-
We saw in the chapter opener that the T. Cain Grocery offers its employees a health care plan with a high deductible of $4,500 per year. What effect do high-deductible plans have on how often...
-
Limonene is a compound found in orange oil and lemon oil. When limonene is treated with excess hydrogen and a platinum catalyst, the product of the reaction is 1-isopropyl-4-methylcyclohexane. When...
-
Identify each of the following as an internal control objective (O), an internal control activity (A), or a limitation of internal control (L). 1. Separation of duties 2. Collusion 3. Proper...
-
Cost-plus, target pricing, working backward. The new CEO of Roile Manufacturing has asked for a variety of information about the operations of the firm from last year. The CEO is given the following...
-
1. Super Delicious Cakes is involved in selling cakes. You are required to classify the following costs according to their behaviour either fixed cost, variable cost,semi- fixed or semi-variable...
-
You have been hired by Gnomeo, Inc., a company that buys and resells miniature garden gnomes. The company started business on January 1, 2019. The chief accountant has asked you to compile a set of...
-
PROBLEM 2: Recall that according to Poiseuille's law, the flow resistance in a tube of circular cross section is given by: R= 8nl (a) Calculate the flow resistance, R, for a horizontal tube of radius...
-
https://www.washingtonpost.com/news/answer-sheet/wp/2016/05/10/a-master-teacher-went-to-court-to-challenge-her-low-evaluation-what-her-win-means-for-her-profession/ Can you think of other instances...
-
5 Lt/s water enters a disc-shaped rotor axially as shown in the figure. 8=300 with tangential direction from 3 radial channels in the disc at the angle comes out. Cross section of channels 18 mm2 is....
-
Maersk Line case Reflect about the role of social media in B2B industries. Please answer these two questions: 1. Why do you think Maersk has been so successful in social media? What are the expected...
-
Choose a social media listening tool and begin researching your topic. Briefly describe your initial findings relative to your research question. What are the strengths and limitations of the social...
-
Consider the 4-period binomial model. The current stock price(S0) is $100, and possible prices for the next period are $105 and $97. Assume the periodic risk-free rate is 1%. a. Graph the binomial...
-
Concord Company's income statement for the year ended December 31, 2017 contained the following summary information. Service revenues $849,000 Operating expenses (excluding depreciation) $ 621,000...
-
What is removed during each of the three stages of wastewater treatment: primary, secondary, and tertiary? During which state would you expect items to be recovered that were accidentally flushed,...
-
On July 1, 2012, Ted, age 73 and single, sells his personal residence of the last 30 years for $365,000. Ted's basis in his residence is $35,000. The expenses associated with the sale of his home...
-
How are qualified dividends taxed in 2012? Please give the two rates of tax which apply to qualified dividends, and specify when each of these rates applies._________________________...
-
Van makes an investment in a partnership in 2012. Van's capital contributions to the partnership consisted of $30,000 cash and a building with an adjusted basis of$70,000, subject to a nonrecourse...
-
How are U.S. companies affected by international accounting standards?
-
Learning the language of business Match each of the numbered descriptions 1 through 7 with the term or phrase it best reflects. Indicate your answer by writing the letter for the term or phrase in...
-
Identifying accounting users and uses Much of accounting is directed at serving the information needs of those users that are external to an or- ganization. Identify at least three external users of...
Study smarter with the SolutionInn App