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 user’s 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

Step by Step Solution

3.41 Rating (145 Votes )

There are 3 Steps involved in it

Step: 1

Solution to 1 string inputType your string printYour string is string print printPrinting entered st... 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

Matlab An Introduction with Applications

Authors: Amos Gilat

5th edition

1118629868, 978-1118801802, 1118801806, 978-1118629864

More Books

Students also viewed these Programming questions