7.12. strings are mutable

You can change the letters in an string one at a time using the [] operator on the left side of an assignment.

The active code below changes the first letter in greeting to be 'J'.

This produces the output Jello, world!.

Before you keep reading...

Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.

Put together the code below to create a function mixer that takes in two strings and replaces every even index of the first string by the corresponding index of the second. It returns the modified first string. Example: string_a = "food" and string_b = "summer" . mixer(string_a ,string_b ) makes string_a become “somd”.

Assume second string is greater than first.

You have attempted 1 of 5 activities on this page