CMPSCP 3313 – Advanced Computer Language – Python and Perl

CMPSCP 3313 – Advanced Computer Language – Python and Perl

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!
1. Create a list named listA containing integer values 1 2 3 4 5 in that order
2. Create a list named listB containing 3 individual character values a b c in that order
3. Use the extend method to concatenate the two strings with listA appended by listB
4. Use single print command to print the new listA
5. Use a single print command with proper index value to print the ‘a’ from the new listA
6. Use the insert method to insert the string “XYZ” between the 5 and the ‘a’ in listA
7. Use the append method to put a 5 at the end of listA
8. Use a single print command with appropriate slice to display the slice of listA that begins with 4
and ends with ‘b’ (inclusive)
9. Use the count method in an if statement to display the index value for the first occurrence of 5
in listA if at least one occurrence exists, otherwise display an error message indicating “Not
found”
10. Use a for loop to print each item in listA individually

SAMPLE ASSIGNMENT
Powered by WordPress