Question: For this lab, your task is to write a Python program using the concepts in this week's material. In this assignment, create Python code that

For this lab, your task is to write a Python program using the concepts in this week's material. In this assignment, create Python code that does the following:

1. Ask the user for a string.

2. Print the length of the string

3. Print whether the string is all lowercase or not

4. Ask the user for a word and print if that word is in the string

5. Ask the user for a floating-point number.

6. Print the floating-point number that was entered by the user with one decimal place in the output. Then print the floating-point number with three decimal places in the output.

Example Output (User input in bold)

Enter a string to check: Flubberdill

The string is 11 characters long

The string is not all lowercase

Enter a word to look for in the string: berd

That word IS in the string Please enter a floating-point number: 67.563389

The number is 67.6 The number is also 67.563

Here is my code

# Ask the user for a string input_string = input("Enter a string to check: ")

# Print the length of the string print("The string is", len(input_string), "characters long")

# Print whether the string is all lowercase or not if input_string.islower():

print("The string is all lowercase") else: print("The string is not all lowercase")

# Ask the user for a word and print if that word is in the string word_to_check = input("Enter a word to look for in the string: ")

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!