Question: Write a single python program to perform the following tasks in order specified using the commands provided and discussed during class: KEEP IT SIMPLE AND

 Write a single python program to perform the following tasks in

Write a single python program to perform the following tasks in order specified using the commands provided and discussed during class: KEEP IT SIMPLE AND FOLLOW INSTRUCTIONS PROVIDED IN CLASS! 1. Create a string named stringA containing "hello" 2. Create a string named string containing "ecu" 3. If stringB is all lowercase, use a single command to concatenate stringA with first character capitalized followed by a single space and string converted to uppercase producing a new string named stringC. In the if statement, print resulting stringC to verify you received "Hello ECU" 4. Create a string named stringX containing "username:password:UID:GID:Name+123456:homedir:shell." 5. Use a single if statement command/condition to strip the excess colons from both ends and compare the remaining count of colons to 6. If the number of colons counted after excess have been stripped is 6, then use a combined strip and split command to create a list of the items separated by colons (excluding the excessive colons on ends) called listx. Use a single print command in the if statement to print the contents of the list to verify you received is ['username', 'password', 'UID', 'GID', 'Name+123456', 'homedir', 'shell'] 6. Use a single command to split the occurrence of the string 'Name+123456' in the list on the '+' and assign the second part of that resulting list to a new string called idnum. 7. If idnum contains all digits, print idnum to confirm it contains 123456" 8. Print stringx with : replaced by a maximum of 5 times. Output should be "username password|UID|GID:Name+123456:homedir:shell..." 9. Attempt to replace the 3rd item in the string idnum with X using direct assignment. Note: You should receive an error message indicating string objects do not support item assignment

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!