1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Minchanka [31]
3 years ago
9

Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in

the string. The output should include the input character and use the plural form, n's, if the number of times the characters appears is not exactly 1. g
Computers and Technology
1 answer:
Zielflug [23.3K]3 years ago
7 0

Answer:

The program in Python is as follows:

string = input("String: ")

chr = input("Character: ")[0]

total_count = string.count(chr)

print(total_count,end=" ")

if total_count > 1:

   print(chr+"'s")

else:

   print(chr)

Explanation:

This gets the string from the user

string = input("String: ")

This gets the character from the user

chr = input("Character: ")[0]

This counts the occurrence of the character in the string

total_count = string.count(chr)

This prints the total count of characters

print(total_count,end=" ")

If the count is greater than 1

if total_count > 1:

Then it prints a plural form

   print(chr+"'s")

If otherwise

else:

Then it prints a singular form

   print(chr)

You might be interested in
Compare and contrast the properties of a centralized and a distributed routing algorithm. give an example of a routing protocol
Naily [24]

Answer and Explanation:

Centralized : Central node in the system gets whole data about the system topology, about the traffic and about different hubs. This at that point transmits this data to the particular switches. The benefit of this is just a single hub is required to keep the data. The hindrance is that if the focal hub goes down the whole system is down, for example single purpose of disappointment.

Distributed: Distributed nodes gets data from its neighboring hubs and afterward takes the choice about what direction to send the parcel. The weakness is that if in the middle of the interim it gets data and sends the parcel something changes then the bundle might be deferred.

Example :

Link State takes Centralized approach

Distance Vector takes Decentralize approach

8 0
3 years ago
How does an ALU perform a logical operation? A. It compares two conditions. B. It compares two additions. C. It compares two mul
german
A.It compares two conditions
6 0
3 years ago
Read 2 more answers
I am a receptionist for a large corporation
Musya8 [376]
Therefore the answer is within yourself
5 0
4 years ago
The /home/gshant/smp directory contains several files. The directory and files need to be removed. The current working directory
kherson [118]

Explanation:

Whenever a user types in a command at the command line that is not built into the shell or that does not include its absolute path and then presses the Enter key, the shell searches through those directories, which constitute the user's search path, until it finds an executable file with that name.

3 0
3 years ago
Which one of the following careers is the most highly resistant to economic change?
Eduardwww [97]

Answer:

Video game designers bbbbbbbbbbbbb

8 0
3 years ago
Other questions:
  • A computer with a domain name is called a
    8·2 answers
  • Additional rows and columns are inserted into a table by using the _____ tab
    7·2 answers
  • A claim that is printed and mailed to the carrier site is called a _______copy?
    13·1 answer
  • As featured on Wednesday's show: Researchers in Florida have observed less human impact on what kind of reptile, which nests on
    7·1 answer
  • In which area is composing for games similar to composing for
    14·1 answer
  • The objective of this task is to use Scapy to estimate the distance, in terms of number of routers, between your VM and a select
    10·1 answer
  • A Python keyword ______________.
    15·1 answer
  • What font family is Times New Roman an what font family is Arial?
    9·2 answers
  • Question #1
    5·2 answers
  • How do you add verticse in edit mode blender
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!