python
Suppose city is a variable that holds a string of at least 5 characters. Write one statement that assigns to a variable named letter the third letter of the string stored in city as an upper case letter. (Note: We'll assume the third letter of city is a letter)
city = input("enter the city name ")
# printing original string
#print("The original string is : " + str(city))
# initializing N
N = 2
# Using upper() + string slicing
# Uppercase Nth character
letter = city[N].upper()
# printing result
print( str(letter))
Explanation:
Get Answers For Free
Most questions answered within 1 hours.