Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use python 6. Ask the user for a number, then a word, and then print out a phrase that depends on the number and the

image text in transcribed
image text in transcribed
use python
6. Ask the user for a number, then a word, and then print out a phrase that depends on the number and the word. You should pluralize the word by adding an "s" to the end whenever they enter a number that is O or greater than 1. In: 0 In: bat Out: O bats In: 1 In: cat Out: 1 cat In: 4 In: dog Out: 4 dogs Let's implement some more advanced rules: Words ends in: -ife -sh/ch Becomes: -ives -shes/ches Example: life -> lives bush -> bushes church -> churches cactus -> cacti guy -> guys -ay/oyley/uy -ays/oysleys/uys toy -> toys key -> keys way -> ways fly -> flies hat -> hats -ies everything else add -s To do this, you'll have to use string slicing. The following table provides the shortcuts for common tools you might need: word = "computerz" print(word[:5]) # prints "compu" print(word[:-1]) # prints "computer" print(word(4:1) #prints "uterz" print(word (-3:]) # prints "erz

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

Microsoft Outlook 2023

Authors: James Holler

1st Edition

B0BP9P1VWJ, 979-8367217322

Students also viewed these Databases questions