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

Respuesta :

Answer:

s = input("Enter a string: ")

print(len(s))

print(s*10)

print(s[0])

print(s[:3])

print(s[len(s)-3:])

print(s[::-1])

if len(s) >= 7:

   print(s[6])

else:

   print("The string is not long enough")

print(s[1:len(s)-1])

print(s.upper())

print(s.replace("a", "e"))

Explanation:

*The code is in Python.

Ask the user to enter a string

Use len method to get the total number of characters

Use "*" to repeat 10 times

Use index, 0,  to get first character

Use slicing to get first three characters

Use slicing to get last three characters

Use slicing to get it in backwards

Check if the length is greater than or equal to 7. If it is, use index, 6. Otherwise, print a message.

Use slicing to remove first and last characters

Use upper method to get it in all caps

Use replace method to replace the "a" with the "e"

The program that ask the user to enter a string and print the  (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

is as follows:

x = str(input("please enter a string: "))

print(len(x))

print(x*10)

print(x[0])

print(x[0:3])

print(x[-3:])

print(x[::-1])

if len(x) >= 7:

  print(x[6])

else:

  print("The string is not up to length 7")

print(x[1:-1])

print(x.upper())

print(x.replace('a', 'e'))

The first line ask the user for a string input.

Print length of the user input

Print the user input ten times.

Print the first value of the user input

print the first three string

Print the last three string

Print the reverse of the string

if the length of the user input is greater than or equals to zero, then print the 7th term of the user input.

else it will print that the string length is not up to seven.

Remove the first and the last term of the user input and print the remaining user input.

print the uppercase of the user input.

Replace a with e in the user input.

learn more on python here: https://brainly.com/question/20202506?referrer=searchResults

ACCESS MORE
EDU ACCESS