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

Answers

Answer 1

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)


Related Questions

To reduce the number of used digital outputs of the microcontroller, the display board is connected to the main board through the integrated circuit of the decoder, which converts binary coded decimal (BCD) values to signals for the seven-segment display. So, to show any number on the display you need to set the required BCD code on the microcontroller's outputs. Write a program to convert an integer number represented as a string to a BCD code required for the display. In the BCD code, every decimal digit is encoded with its four-bit binary value. Encoding all digits of the decimal number and concatenating the resulting codes into one string you will get a resulting BCD code. A space is used to separate digits in the BCD code and make it more readable. For example, a number 173 will be encoded to BCD as 0001 0111 0011.

Answers

Answer:

The program in Python is as follows:

BCD = ["0001","0010","0011","0100","0101","0110","0111"]

num = input("Decimal: ")

BCDValue = ""

valid = True

for i in range(len(num)):

   if num[i].isdigit():

       if(int(num[i])>= 0 and int(num[i])<8):

           BCDValue += BCD[i]+" "

       else:

           valid = False

           break;

   else:

       valid = False

       break;

if(valid):

   print(BCDValue)

else:

   print("Invalid")

Explanation:

This initializes the BCD corresponding value of the decimal number to a list

BCD = ["0001","0010","0011","0100","0101","0110","0111"]

This gets input for a decimal number

num = input("Decimal: ")

This initializes the required output (i.e. BCD value)  to an empty string

BCDValue = ""

This initializes valid input to True (Boolean)

valid = True

This iterates through the input string

for i in range(len(num)):

This checks if each character of the string is a number

   if num[i].isdigit():

If yes, it checks if the number ranges from 0 to 7 (inclusive)

       if(int(num[i])>= 0 and int(num[i])<8):

If yes, the corresponding BCD value is calculated

           BCDValue += BCD[i]+" "

       else:

If otherwise, then the input string is invalid and the loop is exited

           valid = False

           break;

If otherwise, then the input string is invalid and the loop is exited

   else:

       valid = False

       break;

If valid is True, then the BCD value is printed

if(valid):

   print(BCDValue)

If otherwise, it prints Invalid

else:

   print("Invalid")

who would benefit from using self-driving cars

Answers

Answer:

self independent

no need to depend on others

Answer:

Door dash employee's/Uber eat employees

would benefit from this

answer any one: write a computer program:​

Answers

Answer:

hope this helps you look it once.

A security team has downloaded a public database of the largest collection of password dumps on the Internet. This collection contains the cleartext credentials of every major breach for the last four years. The security team pulls and compares users' credentials to the database and discovers that more than 30% of the users were still using passwords discovered in this list. Which of the following would be the BEST combination to reduce the risks discovered?

a. Password length, password encryption, password complexity
b. Password complexity least privilege, password reuse
c. Password reuse, password complexity, password expiration
d. Group policy, password history, password encryption

Answers

Answer:

a. Password length, password encryption, password complexity

Explanation:

Under this scenario, the best combination would be Password length, password encryption, password complexity. This is because the main security problem is with the user's passwords. Increasing the password length and password complexity makes it nearly impossible for individuals to simply guess the password and gain access, while also making it extremely difficult and time consuming for hackers to use software to discover the password as well. Password excryption would be an extra layer of security as it encrypts the password before storing it into the database, therefore preventing eavesdroppers from seeing the password and leaked info from being used without decryption.

Apart from the OOPs concepts learned in this lesson, identify additional concepts and write an essay on their functions. Explain how they are used in a program.
PLSSSS HELLP MEEE ASAP!!!!​

Answers

Explanation:

Object Oriented Programming (OOPS or OOPS for Object Oriented Programming System) is the most widely used programming paradigm today. While most of the popular programming languages are multi-paradigm, the support to object-oriented programming is fundamental for large projects. Of course OOP has its share of critics. Nowadays functional programming seems the new trendy approach. Still, criticism is due mostly to misuse of OOP.


Explain working principle of computer.​

Answers

Explanation:

The working principle of the computer system. Computers do the work primarily in the machine and we can not see, a control center that converts the information data input to output. This control center, called the central processing unit (CPU), How Computers Work is a very complex system.

hope it is helpful to you

PLEASE HELP ME FIX THIS CODE.

I WANT IT TO HAVE USER INPUT TO CHANGE AND IMAGE FILTER TO BLUE RED OR GREEN.


user_color = input("What color would you like to paint the canvas, blue, red or green?:")



def user_red(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]

return pixel

def user_green(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]

return pixel

def user_blue(pixel):
pixel[0] = 100 + pixel[0]
pixel[1] = 100 - pixel[1]
pixel[2] = 100 - pixel[2]

return pixel


def custom_filter(image, user_color):
for x in range(image.get_width()):
for y in range(image.get_height()):
pixel = image.get_pixel(x,y)
new_colors = invert_pixel(pixel)
image.set_red(x, y, new_colors[0])
image.set_green(x, y, new_colors[1])
image.set_blue(x, y, new_colors[2])



return image


def change_image():
global image
image = custom_filter(image, user_color)



timer.set_timeout(change_image, IMAGE_LOAD_TIME)

Answers

PLEASE HELP ME FIX THIS CODE.

I WANT IT TO HAVE USER INPUT TO CHANGE AND IMAGE FILTER TO BLUE RED OR GREEN.

user_color = input("What color would you like to paint the canvas, blue, red or green?:")

def user_red(pixel):

pixel[0] = 100 + pixel[0]

pixel[1] = 100 - pixel[1]

pixel[2] = 100 - pixel[2]

return pixel

def user_green(pixel):

pixel[0] = 100 + pixel[0]

pixel[1] = 100 - pixel[1]

pixel[2] = 100 - pixel[2]

return pixel

def user_blue(pixel):

pixel[0] = 100 + pixel[0]

pixel[1] = 100 - pixel[1]

pixel[2] = 100 - pixel[2]

return pixel

def custom_filter(image, user_color):

for x in range(image.get_width()):

for y in range(image.get_height()):

pixel = image.get_pixel(x,y)

new_colors = invert_pixel(pixel)

image.set_red(x, y, new_colors[0])

image.set_green(x, y, new_colors[1])

image.set_blue(x, y, new_colors[2])

return image

def change_image():

global image

image = custom_filter(image, user_color)

timer.set_timeout(change_image, IMAGE_LOAD_TIME)

draw a flowchart and write the algorithm to find even number between 1 to 50​

Answers

Answer:We Explain the flowchart in following images given below..

Please hit a like and thanks

La herramienta …………………………... en el programa CorelDraw X8, está conformado por texto artístico.

Answers

Answer

what are you talking about, thats crazy!

Explanation:

no seriasly, what are you taking about

Create a PetStore class, a Dog class, and Cat class. Once instantiated, a PetStore should be able to take in and give out pets. The store's method for receiving pets should be called receive. This method should take a single pet object (either a Dog or Cat instance) and should add it to the store's inventory of pets. The store's method for giving out a pet should be called sell and can take no arguments. The method returns a pet when called.

Answers

Answer:

thanks to the great place

Explanation:

hottest year in hindi history and happiness and the world is not a big deal to me because I think it's a good thing for a woman who has been a good friend of yours and happiness and be happy with examples

Fill in the blanks using A to J below.

1. ----- = command driven

2. ----- = general purpose

3. ----- = custom written

4. ----- = icon

5. ----- = menu driven

6. ----- = integrated software

7. ----- = desktop

8. ----- = system software

9. ----- = Window

10. ----- = software house

A. Software written to meet the specific needs of a company.

B. Related specialized programs combined in a unified package.

C. This software can be adapted for specific needs but is not written for any specific business purpose.

D. This interface requires the user to type in codes or words.

E. A pictorial representation of a file, folder, program, task or procedure.

F. This interface allows you to move a mouse or cursor to make a selection.

G. A rectangle that displays information on the screen.

H. A visual background over which all your work is done.

I. This software notifies the computer to begin sending data to the appropriate program to get a document printed.

J. A company that specializes in writing software.

Answers

Answer:

A.software written to meet specific needs of company

B.Related specialized programs combined in a unified package

The L-exclusion problem is a variant of the starvation-free mutual exclusion problem. We make two changes: as many as L threads may be in the critical section at the same time, and fewer than L threads might fail (by halting) in the critical section. An implementation must satisfy the following conditions:_____.
L-Exclusion: At any time, at most L threads are in the critical section.
L-Starvation-Freedom: As long as fewer than L threads are in the critical section, then some thread that wants to enter the critical section will eventually succeed (even if some threads in the critical section have halted).
Modify the n-process Bakery mutual exclusion algorithm to turn it into an L-exclusion algorithm. Do not consider atomic operations in your answer. You can provide a pseudo-code solution or written solution.

Answers

Answer:

The solution is as follows.

class LFilters implements Lock {

int[] lvl;

int[] vic;

public LFilters(int n, int l) {

lvl = new int[max(n-l+1,0)];

vic = new int[max(n-l+1,0)];

for (int i = 0; i < n-l+1; i++) {

lvl[i] = 0;

}

}

public void lock() {

int me = ThreadID.get();

for (int i = 1; i < n-l+1; i++) { // attempt level i

lvl[me] = i;

vic[i] = me;

// rotate while conflicts exist

int above = l+1;

while (above > l && vic[i] == me) {

above = 0;

for (int k = 0; k < n; k++) {

if (lvl[k] >= i) above++;

}

}

}

}

public void unlock() {

int me = ThreadID.get();

lvl[me] = 0;

}

}

Explanation:

The code is presented above in which the a class is formed which has two variables, lvl and vic. It performs the operation of lock as indicated above.

How many types of video
compressions__
a. 4
b. 2.
• c. 3
d. 6​

Answers

A. I think correct me if I’m wrong

List the types of infrared we have

Answers

Answer: infared types like the sun, sun light, heat lamps, and radiators

Implement the function _isPalindrome() in palindrome.py, using recursion, such that it returns True if the argument s is a palindrome (ie, reads the same forwards and backwards), and False otherwise. You may assume that s is all lower case and doesn’t include any whitespace characters.

Answers

Answer:

The function is as follows:

def _isPalindrome(stri) :

  if len(stri) == 0:

     return True

  if stri[0] == stri[len(stri) - 1]:

     return _isPalindrome(stri[1:len(stri) - 1])

  else:

     return False

Explanation:

This defines the function

def _isPalindrome(stri) :

If the string is empty, then it is palindrome

  if len(stri) == 0:

     return True

This checks if the characters at alternate positions are the same.

If yes, it calls the function to check for other characters

  if stri[0] == stri[len(stri) - 1]:

     return _isPalindrome(stri[1:len(stri) - 1])

If otherwise, the string is not palindrome

  else:

     return False

Crop-Harvesting robots manage harvest automation, seeding, and weeding.
True
False

Answers

Answer: False

Explanation: I think there are specific robots for seeding, weeding and harvest automation. Unless its a multi purposed crop-harvesting robot I would assume it would only be related to harvesting tasks. (picking)

More info here: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC7273211/

HOW TO DOWNLOAD BEAMNG DRIVE

Answers

Explanation:

Answer:

Explanation:

on what device

def shared_motif(dna_list):
This function takes in a list of DNA strings and returns the longest common substring. A substring is a contiguous sequence of characters within a string. A common substring is a substring of every element in the given list of DNA strings. Note that the number of DNA strings in the input list is not always the same! There may be multiple solutions, but you only need to return the first one.
Example:
Sample input DNA list:
("GATTACA", "TAGACCA", "ATACA"]
The returned longest common substring:
"TA"

Answers

Answer:

Explanation:

The following code is written in Python, the function creates various nested loops to loop through each individual string comparing letter by letter in order to find the longest common substring. Finally, returning the substring itself.

def shared_motif(dna_list):

   substr = ''

   if len(dna_list) > 1 and len(dna_list[0]) > 0:

       for x in range(len(dna_list[0])):

           for i in range(len(dna_list[0]) - x + 1):

               if i > len(substr) and all(dna_list[0][x:x + i] in y for y in dna_list):

                   substr = dna_list[0][x:x + i]

   return substr

arr = ["GATTACA", "TAGACCA", "ATACA"]

stems = shared_motif(arr)

print(stems)

What is the main fuction of command interpreter​

Answers

The command interpreter or the command-line interface is one of the ways a user can interface with the operating system. The command interpreter's main task is to understands and executes commands which it turns into system calls. The kernel is the central module of an OS.

_________________

Brainliest would be greatly appreciated!

I found this!

_________________

#SpreadTheLove

#SaveTheTrees

- Mitsu JK

determine if each statement is true or false:

graphics designers are responsible for communicating a message: TRUE

portfolios are not important for graphic design careers: FALSE


professional graphic designers join the american institute of graphic arts: TRUE

Answers

Answer:

TRUE

FALSE

TRUE

Explanation:

Graphic designers are sometimes known as communications designers. They communicate information through the creation of visuals. This can be in the form of logos, fliers, animations and so many others.

1) Graphic designers are responsible for communicating a message. This is TRUE because this is the top reason for their profession. They communicate messages/ pass information through their designs to the desired audience.

2) Portfolios are not important for graphic design careers. This is FALSE. Having portfolios is necessary for graphic designers. This enables them to have a record of all their work so as to showcase to new clients that may set them up for more jobs.

3) Professional graphic designers join the American Institute of Graphic Arts. This is TRUE. The American Institute for Graphic Arts is a professional organization meant for people in the design industry and this includes graphic designers.

what are the difference between bit address 7ch and byte address 7ch

Answers

so a byte address can only send  a get bytes (8 bits)

when a bit address can be more detailed as it can send a get not only bytes but bits also

-scav

explain three main steps in mail merging (6 marks) ​

Answers

Answer:

Explanation:

The mail merging process generally requires the following steps:

Creating a Main Document and the Template.

Creating a Data Source.

Defining the Merge Fields in the main document.

Merging the Data with the main document.

Saving/Exporting.

what is the best plugin for subscription sites?

Answers

Answer:

Explanation:

MemberPress. MemberPress is a popular & well-supported membership plugin. ...

Restrict Content Pro. ...

Paid Memberships Pro. ...

Paid Member Subscriptions. ...

MemberMouse. ...

iThemes Exchange Membership Add-on. ...

Magic Members. ...

s2Member.

Page Setup options are important for printing a PowerPoint presentation a certain way. The button for the Page Setup dialog box is found in the
File tab.
Home tab.
Design tab.
Slide Show tab.

Answers

Answer: Design tab

Explanation:

The page setup simply refers to the parameters which are defined by a particular user which is vital in knowing how a printed page will appear. It allows user to customize the page layout. The parameters include size, page orientation, quality of print,margin etc.

It should be noted that page setup options are vital for printing a PowerPoint presentation in a certain way and the button for the Page Setup dialog box can be found in the design tab.

A train protection system automatically applies the brakes of a train if the speed limit for a segment of track is exceeded, or if the train enters a track segment that is currently signaled with a red light (i.e., the segment should not be entered). There are two critical-safety requirements for this train protection system:
The train shall not enter a segment of track that is signaled with a red light.
The train shall not exceed the specified speed limit for a section of track.
Assuming that the signal status and the speed limit for the track segment are transmitted to on-board software on the train before it enters the track segment, propose five possible functional system requirements for the onboard software that may be generated from the system safety requirements.

Answers

Explanation:

Five possible functional system requirements for the onboard software that may be generated from the system safety requirements:

software should enable the brakes to be applied instantly when the red light is signaled.speed of the train should be monitored when it's running on a segment so that it does not exceed the maximum speed limit.important for the system to examine the color displayed before a train enters a segment of the track.constant checking of the speed limit and color of the light so as to determine when the brakes should be applied. when there is a red light the system should notify/prevent the train from entering the segment.

What’s unique about windows 8 compared to earlier windows

Answers

New Interface, features like start screen, faster boot time, dynamic desktop, improved search function, windows love syncing, windows to go, and improved security.

∉∉∉⊆αβ∞∞the life of me

Answers

Answer:

?

Explanation:

I honestly agree to this statement
So poetic

Which line of code will use the overloaded multiplication operation?

class num:
def __init__(self,a):
self.number = a

def __add__(self,b):
return self.number + 2 * b.number

def __mul__(self, b):
return self.number + b.number

def __pow__(self, b):
return self.number + b.number

# main program
numA = num(5)
numB = num(10)

Which line of code will use the overloaded multiplication operation?

class num:
def __init__(self,a):
self.number = a

def __add__(self,b):
return self.number + 2 * b.number

def __mul__(self, b):
return self.number + b.number

def __pow__(self, b):
return self.number + b.number

# main program
numA = num(5)
numB = num(10)

a) product = numA * numB
b) product = numA.multiply(numB)
c) product = numA.mul(numB

Answers

For multiplication one: product = numA * numB

For the addition: result = numA + numB

got 100 on this ez

(searched all over internet and no one had the answer lul hope this helps!)

Answer: First option: product = numA * numB

second option-numA + numB

Explanation:

Careers emerge solely to make profit for the industry.


False

True

Answers

Explanation:

Careers emerge solely to make profit for the industry: False

Brainliest and follow and thanks

morning dude

Write a C program that right shifts an integer variable 4 bits. The program should print the integer in bits before and after the shift operation. Does your system place 0s or 1s in the vacated bits?

Answers

Solution :

#include<[tex]$\text{stdio.h}$[/tex]>

#include<conio.h>

void dec_bin(int number) {

[tex]$\text{int x, y}$[/tex];

x = y = 0;

for(y = 15; y >= 0; y--) {

x = number / (1 << y);

number = number - x * (1 << y);

printf("%d", x);

}

printf("\n");

}

int main()

{

int k;

printf("Enter No u wanted to right shift by 4 : ");

scanf("%d",&k);

dec_bin(k);

k = k>>4; // right shift here.

dec_bin(k);

getch();

return 0;

}

Other Questions
Dorothea Dix was an educator who first saw the connection betweenBeing sent to prison and mental illnessBeing sent to prison and physical ailmentsThe need to educate inmates in prisonAll of the above Given thatx= 9.5 m and= 20, work out AC rounded to 3 SF Two of Interpret Inc's products, QI and VH, emerge from a joint process. Product QI has been allocated $15,300 of the total joint costs of $36,000. A total of 2,200 units of product QI are produced from the joint process. Product QI can be sold at the split-off point for $10 per unit, or it can be processed further for an additional total cost of $10,200 and then sold for $12 per unit. If product QI is processed further and sold, what would be the financial advantage (disadvantage) for the company compared with sale in its unprocessed form directly after the split-off point Question 11 (1 point)A cell containing 28 chromosomes undergoes mitosis and cell division. How many chromosomes will each of the resulting daughter cellscontain?a28b756d14 a que familia pertenece las lenguas europeas If you could change something you didor something that happened this schoolyear, what would it be? Why?Help me guys :(((:) Seven friends share 3 bags of trail mix equally. What fraction of a bag of trail mix does each friend get? Each friend will receive of a bag of trail mix. SOMEONEEE PLEASEEEE HELPPPP OVERRR DUEEEE Which role do ultrafine particles play in dirty air?They contribute to less than 13,000 premature deaths a year.They can worsen symptoms for people with breathing difficulties.They are easily removed from the air when people see them floating.They are constantly filtered by the nose, which prevents lung absorption A farmer wants to build a pond for her cows. What step must she take in order to build the pond?A. Dig into the zone of aeration.B. Place a permeable material on the ground.C. Keep the soil moist.D. Place an impermeable material on the ground. Lily invested $12,300 in an account for 15 years that compounds interests continuously at rate of 3.75%. What is her account worth after that time? You are rolling a pair of dice what's is the probability of getting different numbers on both dice 9b^2=16 solve using Quadratic Identical satellites X and Y of mass m are in circular orbits around a planet of mass M. The radius of the planet is R. Satellite X has an orbital radius of 3R, and satellite Y has an orbital radius of 4R. The kinetic energy of satellite X is Kx . Satellite X is moved to the same orbit as satellite Y by a force doing work on the satellite. In terms of Kx , the work done on satellite X by the force is Cul de estas sustancias exhibe combustibilidad?El acero.El hierro.El vidrio.El papel. Help me. Do not send links or fake answer if not I will report you. The photo will be above Thanks The perimeter of a photograph is 34 inches. It is 10 inches long. How wide is it?inches A fiber reinforced composite contains e-glass fibers in an epoxy matrix. E for the glass is 72 GPa, E for the epoxy is 2.4 GPa. Find the elastic modulus of a composite that contains 5% fibers in the longitudinal direction, Ecl Help pleaseeeeeeeeeeee Qu es el tiempo en el teatro?