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
Amiraneli [1.4K]
3 years ago
6

Please use Python 3 to solve the following problem. Please also show all outputs and share code.The variable sentence stores a s

tring. Write code to determine how many words in sentence start and end with the same letter, including one-letter words. Store the result in the variable same_letter_count.Hard-coded answers will receive no credit.sentence = "students flock to the arb for a variety of outdoor activities such as jogging and picnicking"
Computers and Technology
1 answer:
Harman [31]3 years ago
5 0

Answer:

The code is given in Python below with its output.

Explanation:

"""

User is asked to enter the input in sentence

"""

sentence=input("Enter the sentence :")

"""

sentence is converted to list named words

"""

words=sentence.split()

same_letter_count=0

"""

In for loop we access each word

and check character at index 0 and at last index

is same or not.

"""

for word in words:

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

   same_letter_count+=1

 

print("The same letter count is",same_letter_count)

<u>OUTPUT:: </u>

TEST CASE 1::

Enter the sentence :students flock to the arb for a variety ofoutdoor activities such as jogging and picknicking

The same letter count is 2

TEST CASE 2::

Enter the sentence :i am a bit madam

The same letter count is 3

You might be interested in
Help it's the last question quickkk​
aniked [119]
I would say the answer is b, but ⟟ might be wrong
7 0
3 years ago
The 'client area' of a window is the area used to display the contents of the window (thus a title bar or border would lie outsi
Lady_Fox [76]

Answer:

<u>Window.java</u>

  1. public class Window {
  2.    int width;
  3.    int height;
  4.    public Window(int width, int height){
  5.        this.width = width;
  6.        this.height = height;
  7.    }
  8.    public int getWidth(){
  9.        return width;
  10.    }
  11.    public int getHeight(){
  12.        return height;
  13.    }
  14.    public int getClientAreaHeight(){
  15.        return getHeight();
  16.    }
  17. }

<u>Main.java</u>

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        Window win1 = new Window(12, 15);
  4.        System.out.println(win1.getClientAreaHeight());
  5.    }
  6. }

Explanation:

<u>Window.java</u>

There is a Window class with two int type attributes, width and height (Line 1 - 3).

The constructor of this class will take two inputs, width and height and set these input to its attributes (Line 5 - 8). There are two methods getWidth and getHeight which will return the value of attributes width and height, respectively (Line 10 - 16).

The required new method getClientAreaHeight is defined in line 18 -20. This method will call the getHeight method to return the height value of the window (Line 19).

<u>Main.java</u>

We test the Window class by creating one Window instance and call the getClientAreaHeight method and print the return output (Line 1 -6).

We shall see 15 is printed.

4 0
3 years ago
What is the worst case time complexity of insertion sort where position of the data to be inserted is calculated using binary se
laiz [17]

Answer:

O(n²)

Explanation:

The worse case time complexity of insertion sort using binary search for positioning of data would be O(n²).

This is due to the fact that there are quite a number of series of swapping operations that are needed to handle each insertion.

4 0
2 years ago
Rony works on several confidential files for his company. Ignoring the privacy requirements, Rony places the files in a shared f
kumpel [21]

Answer:

D. ​He should designate all the files in the shared folder as read-only.

Explanation:

The steps Rony should take while using a peer-to-peer (P2P) network to prevent his original files from being overwritten by another P2P user is that He will make the file as read-only.

In making the file read-only, other users who have access to the shared folder can only read the file without modifying it's content.

By default, he is already the owner of the file, so option B is not the correct answer.

Also making the file executable give other users higher privilege, so option A is also not correct.

8 0
3 years ago
The quality of an image is compromised when, what are stretched ?​
german

Answer:

pixels

Explanation:

3 0
2 years ago
Other questions:
  • Energy from sources that can be regenerated or reused is called what?
    12·1 answer
  • ________ hackers break into systems for non-malicious reasons such as to test system security vulnerabilities. black-hat gray-ha
    10·1 answer
  • Which one is a run-on sentence? you get mark the brilist
    5·2 answers
  • What is the fastest way to locate a record for updating?
    6·1 answer
  • Which programming element is used by a game program to track and display score information?
    10·2 answers
  • A _____ network is where all computers are equal and each one is both data requester and data provider.
    13·1 answer
  • The remove() method in the Queue interface ________. Group of answer choices retrieves, but does not remove, the head of this qu
    14·1 answer
  • Who watches the show gravity falls, if you do, if you play the theme song for the first episode backwards you get a hiding messi
    11·2 answers
  • Algorithm to eat orange<br><br>​
    10·2 answers
  • What is Utility Software ? Name any two utility programs. <br>​
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!