## Wednesday, August 28, 2019

Solution Exercise 18

#### Exercise 18

Write a program in Python that asks the user to enter a string s and return a message indicating whether the string contains the letter 'a' by indicating its position on the string. Example if the user types the string s = 'language' the program returns: The letter 'a' is in position: 1 The letter 'a' is in position: 5

#### Solution

``````# Ask user to input a string s
s = input("Type a string s : ")

# getting the len of string s
n = len(s)

# Browsing and reading all characters of string s
for i in range(0,n):
# Try if the browsed character is equal to character 'a'
if(s[i] == 'a'):
print("The letter 'a' is at position : ", i , " in the string s")
``````

Younes Derfoufi

## Python Exercises With Solutions

1. Python Arithmetic Exercises
2. Equations & System Of Equations
3. Polynomials and Functions
4. Python Arithmetic Exercises
5. Numpy, Matplolib, Sympy , Scipy - Exercises
6. Python Arithmetic Exercises

Younes Derfoufi

## Sample Text 