Write code to evaluate the length of the string โI like green eggsโ and print it. It should print โThe length is 17โ. Store the length in a variable named length.
Create a function named count that accepts a string and a letter as arguments, then returns the count of that letter in the string. For example, if the function call was count("banana", "a") it would return 3. Hint: use the count method.
Take the following Python code that stores this string: string = "X-DSPAM-Confidence: 0.8475". Use find and string slicing to extract the portion of the string after the colon character and then use the float function to convert the extracted string into a floating point number called num.
In Robert McCloskeyโs book Make Way for Ducklings, the names of the ducklings are Jack, Kack, Lack, Mack, Nack, Ouack, Pack, and Quack. The following loop tries to output these names in order. Of course, thatโs not quite right because Ouack and Quack are misspelled. Can you fix it?
Write code to print out the statement โHi my name is Bob2โ using only string methods or string slicing. You must get every part of the new string from the given strings, not by using string literals. Name the final string statement.
Write a program that asks a user for their name (store the input in a variable named name) and from the input prints the first letter of their name in lowercase (store it in a variable named lowerFirst).
Write a program that asks for user input (store it in a variable named user_input) and prints their input in all lowercase, as well as the length of their string.