Question: I need help writing this code in python. Given the following string: phrase = Python Programming 141 Write a program that will do the following:
I need help writing this code in python.
Given the following string:
phrase = "Python Programming 141"
Write a program that will do the following:
Write an expression to print the first character.
Write an expression to print the last character.
Write an expression that uses len to print the last character
Write an expression to print "Python"
Write an expression using slicing that will print "Programming"
Write an expression using slicing that will print "141" using negative index values
Write an expression to print the first half of the string up to the letter "a"
Write an expression to print the last half of the string from the letter "a" to the end, including the letter "a"
Using a string method, write an expression to print the string in all uppercase letters
Using a string method, write an expression to print the string in all lowercase letters
Using a string method, write an expression to print the string "P-y-t-h-o-n- -P-r-o-g-r-a-m-m-i-n-g- -1-4-1"
Using a string method, write an expression to print the index of the first "o" in the string Your output should match this Sample Run: P 1 1 Python Programming 141 Python Prog ramming 141 PYTHON PROGRAMMING 141 python programming 141 P-y-t-h-o-n- -P-r-o-g-r-a-m-m-i-n-g- -1-4-1 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
