Write Code Questions

Fix line 2 so that it prints “Hi” instead of “hi”.

Fix line 2 so that it prints “Hi” instead of “hi”.

Fix the code so that only “meow” is printed.

Fix the code so that only “meow” is printed.

Write code to evaluate the length of the string “I like green eggs” and print it. Save the string as s1. It should print “The length is 17”.

Write code to evaluate the length of the string “I like green eggs” and print it. It should print “The length is 17”.

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.

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.

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?

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 a function numDigits that will return the number of digits in an integer n.

Write a function numDigits that will return the number of digits in an integer n.

Write code to print out the statement “Hi my name is Bob and I am 2” 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 code to print out the statement “Hi my name is Bob and I am 2” 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 and from the input prints the first letter of their name in lowercase.

Write a program that asks a user for their name and from the input prints the first letter of their name in lowercase.

Write a program that asks for user input and prints their input in all lowercase, as well as the length of their string.

Write a program that asks for user input and prints their input in all lowercase, as well as the length of their string.

You have attempted of activities on this page