Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python 1) Write a program that asks the user to enter a string. The program should then print the following: (a) The total number

In Python

1) Write a program that asks the user to enter a string. The program should then print the following:

(a) The total number of characters in the string

(b) The string repeated 10 times

(c) The first character of the string (remember that string indices start at 0)

(d) The first three characters of the string

(e) The last three characters of the string

(f) The string backwards

(g) The seventh character of the string if the string is long enough and a message otherwise

(h) The string with its first and last characters removed

(i) The string in all caps

(j) The string with every a replaced with an e

(k) The string with every letter replaced by a space

2. A simple way to estimate the number of words in a string is to count the number of spaces in the string. Write a program that asks the user for a string and returns an estimate of how many words are in the string.

3. People often forget closing parentheses when entering formulas. Write a program that asks the user to enter a formula and prints out whether the formula has the same number of opening and closing parentheses.

4. Write a program that asks the user to enter a word and prints out whether that word contains any vowels.

5. Write a program that asks the user to enter a string. The program should create a new string called new_string from the users string such that the second character is changed to an asterisk and three exclamation points are attached to the end of the string. Finally, print new_string. Typical output is shown below:

Enter your string: Qbert

Q*ert!!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions