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
steposvetlana [31]
2 years ago
5

Write a function named replace_at_index that takes a string and an integer. The function should return a new string that is the

same as the old string, EXCEPT with a dash in place of whatever character was at the index indicated by the integer. Call your function on the word eggplant and the index 3
Computers and Technology
1 answer:
aalyn [17]2 years ago
4 0

Answer:

def replace_at_index(str, number):

   new = str.replace(str[number], "-")

   return new

print(replace_at_index("eggplant", 3))

Explanation:

- Create a function called <em>replace_at_index</em> that takes a string and an integer

- Initialize a new variable called <em>new</em>, that will hold the new string

- Replace the character at given index with dash using <em>replace</em> function, it takes two parameters: the first is the character we want to replace, the second is the new character.

- Return the new string

- Call the function with the required inputs

You might be interested in
What output is produced by the following code? Integer first = new Integer(7); Integer second = first; if (first == second) Syst
fenix001 [56]

Answer:

The correct output of this question is  "Sneezy Sleepy".

Explanation:

In the given code firstly we create the object of the integer class that is first in this we pass the integer value that is 7. Then we declare another second integer variable is this variable we pass object as a reference. Then we use the two conditional statements. In the first, if block we check that the object of the class is equal to the reference variable. If it is true it prints Sneezy. otherwise, it will print Grumpy. In second if block we check that the object of the class is equal to the reference variable. but in this time we the equals() function it is the same as(==). If the condition is true it prints Sleepy. otherwise, it will print Doc. So the output of the code is Sneezy Sleepy.

6 0
2 years ago
If you are going to attach more than 15 devices to your wireless network, you should make sure your router supports which standa
Westkost [7]

Answer:

802.11ac

Explanation:

It is a wireless networking standard.It functions only on 5 Ghz only. 802.11ac has three times the bandwidth of 802.11n hence it can handle more number of users.It has multi-link throughput of 1 gigabit per second.It provides high throughput.It is very useful for environments with high user density.

3 0
3 years ago
Given parameters b and h which stand for the base and the height of an isosceles triangle (i.e., a triangle that has two equal s
schepotkina [342]

Answer:

The area of the triangle is calculated as thus:

Area = 0.5 * b * h

To calculate the perimeter of the triangle, the measurement of the slant height has to be derived;

Let s represent the slant height;

Dividing the triangle into 2 gives a right angled triangle;

The slant height, s is calculated using Pythagoras theorem as thus

s = \sqrt{b^2 + h^2}

The perimeter of the triangle is then calculated as thus;

Perimeter = s + s + b

Perimeter = \sqrt{b^2 + h^2} + \sqrt{b^2 + h^2} +b

Perimeter = 2\sqrt{b^2 + h^2} + b

For the volume of the cone,

when the triangle is spin, the base of the triangle forms the diameter of the cone;

Volume = \frac{1}{3} \pi * r^2 * h

Where r = \frac{1}{2} * diameter

So, r = \frac{1}{2}b

So, Volume = \frac{1}{3} \pi * (\frac{b}{2})^2 * h

Base on the above illustrations, the program is as follows;

#include<iostream>

#include<cmath>

using namespace std;

void CalcArea(double b, double h)

{

//Calculate Area

double Area = 0.5 * b * h;

//Print Area

cout<<"Area = "<<Area<<endl;

}

void CalcPerimeter(double b, double h)

{

//Calculate Perimeter

double Perimeter = 2 * sqrt(pow(h,2)+pow((0.5 * b),2)) + b;

//Print Perimeter

cout<<"Perimeter = "<<Perimeter<<endl;

}

void CalcVolume(double b, double h)

{

//Calculate Volume

double Volume = (1.0/3.0) * (22.0/7.0) * pow((0.5 * b),2) * h;

//Print Volume

cout<<"Volume = "<<Volume<<endl;

}

int main()

{

double b, h;

//Prompt User for input

cout<<"Base: ";

cin>>b;

cout<<"Height: ";

cin>>h;

//Call CalcVolume function

CalcVolume(b,h);

//Call CalcArea function

CalcArea(b,h);

//Call CalcPerimeter function

CalcPerimeter(b,h);

 

return 0;

}

3 0
2 years ago
A linear gradient can be positioned from left to right, top to bottom, or on any angle?
Harman [31]

from left to right because it is used more in expressions

3 0
2 years ago
Suppose as a computer programmer, you have been assigned a task to develop a program to store the sorted data in ascending order
patriot [66]

Answer: i dont know but have an great day

Explanation:

5 0
2 years ago
Other questions:
  • 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
    15·1 answer
  • What is the term for a male reproductive cell?​
    14·1 answer
  • Zoom Vacuum, a family-owned manufacturer of high-end vacuums, has grown exponentially over the last few years. However, the comp
    11·1 answer
  • Answer all 1).The most common layout of keys on the keyboard is the _____ keyboard. ASDF QWERTY JKL QWOPY,
    5·2 answers
  • Store programming components in the shared folder. you want to secure the data in the folder as follows: members of the research
    11·1 answer
  • Ted has $55.00 in his pocket. Which purchase will he be able to pay for with cash?
    9·2 answers
  • Which operating system is a version of Linux?​
    13·1 answer
  • Jane receives an email claiming that her bank account information has been lost and that she needs to click a link to update the
    13·1 answer
  • Test if value is not less than 13.6.
    15·1 answer
  • PLSSSSS HELPP!! Tropical rainforests are home to many kinds of birds, including parrots, toucans and eagles. Each different spec
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!