Computer Science, asked by Bhakyaraj7412, 19 days ago

Write a program that asks the user to enter a string. The program should then print the following: The seventh character of the string

Answers

Answered by omreddym
0

Answer:

1) x = input("Enter a string\n")

2) if(len(x) >= 7):

3)   print(x[7])

Explanation:

Line 1 gets the string x from the user.

Line 2 is to avoid errors, checking if x actually has 7 or more characters.

Line 3 is indented to show it is inside the if condition from Line 2. This line prints the 7th character of string x.

Similar questions