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
White raven [17]
4 years ago
5

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.
Ex: If the input is:

n Monday
the output is:

1
Ex: If the input is:

z Today is Monday
the output is:

0
Ex: If the input is:

n It's a sunny day
the output is:

2
Case matters. n is different than N.

Ex: If the input is:

n Nobody
the output is:

0
Your program must define and call the following function that returns the number of times the input character appears in the input string. int CountCharacters(char userChar, string userString)

Computers and Technology
1 answer:
attashe74 [19]4 years ago
5 0

Answer:

Let me see the picture clearly

Explanation:

You might be interested in
Can someone help me out with this one? I'm not sure why my code is not working
UNO [17]

Answer:

Add this statement at the end of your steps() function

return ""

This statement will not print None at the end of steps.

Explanation:

Here is the complete function with return statement added at the end:

def steps(number):  # function steps that takes number (number of steps to print) as parameter and prints the steps specified by number

   i = 1  #assigns 1 to i

   while i < number + 1:  

       string = str(i) * 3  #multiplies value of i by 3 after converting i to string

       string1 = str(string)  # stores the step pattern to string1

       if i != 0:  # if the value of i is not equal to 0

           string1 = (i * 4*' ' + "\b" + "\b" + "\b" + "\b") + string  #set the spaces between steps

       elif i == 1:  # if value of i is equal to 1

           string1 = string  #set the string to string1

       print(string1)  # print string1

       i = i + 1  # increments i at each iteration

   return "" #this will not print None at the end of the steps and just add a an empty line instead of None.

Screenshot of the corrected program along with its output is attached.

5 0
4 years ago
What device connects your computer to a wireless network?
Darina [25.2K]

Answer:

a router

Explanation:

5 0
3 years ago
Read 2 more answers
Which type of page of replacement algorithm is Windows XP and Unix are using?
mel-nik [20]

Answer:

Windows XP uses the Local Page Replacement algorithm. It is a type of FIFO. In this, Pages are taken from processes using more than their minimum working set and Processes initialize with a default of 50 pages. XP monitors page fault rate and adjusts working set size accordingly.

UNIX uses the Global replacement Algorithm through Modified second-chance clock algorithm.  Here Pages are aged with each second and Pages that are not used for a long time will eventually have a value of zero.

7 0
4 years ago
Please help explain Loops question. I will give brainliest.
OLEGan [10]

Answer:

And 1 and 2 and 3

Explanation:

It is asked to display the 'and' every time, and the count is equal to 1 plus the previous count starting at zero, so it runs 3 times

7 0
2 years ago
Which device acts as a gateway to allow hosts to send traffic to remote ip networks?
SashulF [63]
A router.

------------------------------------
4 0
3 years ago
Read 2 more answers
Other questions:
  • QUESTION 1 Someone may choose to own a car instead of leasing because: AThe car can be resold later to make some money back. BTh
    9·1 answer
  • Charlie is a British national who works in the United States as a novelist for children. Because he is British, he types the wor
    10·2 answers
  • Develop Java methods to perform the following operations on an unordered list (using linked lists). What is the complexity of ea
    15·1 answer
  • Problems of mobile phones
    8·1 answer
  • You have the following code: string name; cout &lt;&lt; "Enter your name : "; cin &gt;&gt; name; If a user enters "Mary Smith" a
    10·1 answer
  • ____________________ parameters are useful in three situations: • When the value of the actual parameter needs to be changed • W
    5·1 answer
  • Help fast pleas. 3. How is this text formatted? (1 point)
    14·1 answer
  • When you hear music, read a printout, or view a video, you are using a computer's
    13·1 answer
  • Consider the following static method.
    9·1 answer
  • Write any two features of Guided media​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!