Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Why is life-cycle costing (LCC) important to the facility manager?

Answered: 1 week ago