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
nataly862011 [7]
3 years ago
14

7.2.8: Part 2, Replace a Letter

Computers and Technology
1 answer:
Archy [21]3 years ago
7 0

def replace_at_index(txt, ind, let):

   new_txt = ""

   for x in range(len(txt)):

       if x == ind:

           new_txt += let

       else:

           new_txt += txt[x]

   return new_txt

print(replace_at_index(input("Enter a word or phrase: "), int(input("Enter an index value: ")), input("Enter the new letter: ")))

I wrote my code in python 3.8. I hope this helps.

You might be interested in
A hardware compatibility list recommends striping with double parity as storage for an application. In a test environment, a tec
riadik2000 [5.3K]

Answer:

RAID level 5 can be used to compensate a limited number of available disks.

Explanation:

There are two type of RAID

  • Software RAID
  • Hardware RAID

Software RAID

deliver services form the host.

Hardware RAID

provides hardware services.

RAID has levels

0, 1, 5, 6, and 10

RAID 0, 1, and 5 work on both HDD and SSD media,

4 and 6 also work on both media.

RAID 0 :Striping

In this level minimum of two disks,RAID 0 split the file strip the data.Multiple hard drive are used to split the data.

RAID 1 : Mirroring

In this level Minimum two disk require and provide data tendency.

RAID 5 :Stripping with parity

Parity is a binary data.RAID system calculate the value which system used to recover the data.

Most RAID system with parity function store parity blocks.

RAID 5 combines the performance of RAID 0 with redundancy of RAID 1.

RAID 5 level should minimize the fault tolerance.

4 0
4 years ago
2. Suppose a computer using direct mapped cache has 220 words of main memory and a cache of 32 blocks, where each cache block co
Advocard [28]

Answer:

(a) The block size = 16 words (b) the format for the sizes of the tag, block, and word fields are stated below:

Tag Block Offset  

11 bits 5 bits 4 bits

(c)The memory address 0DB63 will map to 22nd block and 3 byte of a block. (d)  The main advantage of the cache is, when the cache block is made larger or bigger then, there are fewer misses. this occur when the data in the block is used.

One of the disadvantage is that if the data is not used before the cache block is removed from the cache, then it is no longer useful. here there is also a larger miss penalty.

Explanation:

Solution

(a)The Cache of 32 blocks and the memory is word addressable  

The main memory size is not stated, so let's consider it as 2^20  

The main memory size = 2^20  

The block size = 16 words  

The Number of blocks = main memory size/ block size = 2^20/16. = 2^16= 64 K words.

(b) The Main memory is 2^20, which says it is 1 M words size and it requires 20 bits  

Now,

From which 32 cache block requires 2^5, 5 bits and block size means offset requires 2^4, 4 bits

Thus, the sizes of the tag, block, and word fields are stated below:

Tag Block Offset  

11 bits 5 bits 4 bits

(c)The hexadecimal address is 0DB63 , its binary equivalent is  

0000 1101 1011 0110 0011  

The tag = ( first 11 bits) = 0000 1101 101  

block = ( next 5 bits ) = 1 0110  

offset = ( next 4 bits ) = 0011  

Therefore, the memory address 0DB63 will map to 22nd block and 3 byte of a block.

(d) The main advantage of the cache is that, when the cache block is made larger or bigger then, there are fewer misses. this occur when the data in the block is used.

One of the disadvantage is that if the data is not used before the cache block is removed from the cache, then it is no longer useful. here there is also a larger miss penalty.

3 0
3 years ago
What is one thing we should avoid doing when summarizing a storyline or event in a review?
Rashid [163]
Don't use the same words in the passage or story
6 0
3 years ago
How do you keep word from trying to capitalize every isolated letter "i"
Firdavs [7]
Write "i" the write random words then delete it and add the lowercase i
8 0
3 years ago
Read 2 more answers
To process the elements in an array, the counter in a for loop is commonly used as the ________________ of the array. -g
kobusy [5.1K]
Index




----------------------------------
8 0
3 years ago
Other questions:
  • Software used the control a computer's hardware
    14·1 answer
  • Which is the correct formula to add the values in cells A1 and B1? A. SUM(A1+B1) B. =SUM(A1+B1) C. =SUMA1+B1 D. A1+B1
    9·2 answers
  • If you’re trying to reduce your debt, which of these expenses should you consider cutting out or cutting back on first?
    5·2 answers
  • During the _______ steps of the information processing cycle, data is manipulated, calculated, or organized to create useful inf
    9·1 answer
  • You are required to justify the need to implement a three-tier campus network. Which justification below makes sense for a three
    6·1 answer
  • Talia was a scientist whose research compared the birth rates of young
    12·2 answers
  • You are having trouble cleaning your computer for a troublesome virus. you decide to try to clean your computer while in safe mo
    5·1 answer
  • In the digital age we have less time to absorb and make sense of new information
    12·2 answers
  • And Python code for the following programming problem and the pseudo code below
    5·1 answer
  • State two differences between a mouse pointer and a mouse cursor​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!