Question: Using strings, lists, tuples, and dictionaries. Part 1: How to write a Python program to get a string from a given string where all occurrences
Using strings, lists, tuples, and dictionaries.
Part 1: How to write a Python program to get a string from a given string where all occurrences of its first char have been changed to '$', except the first char itself.
Example Output: Sample String: restart Expected Result: resta$t
Part 2: Given two strings, how to write a Python program to make a single string that separates the two strings by a space and swaps the first two characters of each string.
Example Output: Sample String : 'abc, xyz' Expected Result : 'xyc abz'
Part 3: How to write a python program that randomizes up the words in the sentence The quick brown fox jumped over the lazy dog and prints it out to the user.
Example Output: brown jumped The quick dog over fox lazy the
Part 4: How to take in any sentence as user input and return that sentence randomized.
To makepart 4 easier, always use the tuple list [(10,20,40),(40,50,60),(70,80,90)] and ask the user what they want to change the last element to. This will make the problem significantly easier.
Thank you.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
