12/14


#1

Hey Fellow coders,

I have a problem with this i've used code from other help topics but doesnt work so whats the correct code?
Here is my code

phrase = "A bird in the hand..."

Add your for loop

for char in phrase:
if char == "A" or char == "a":
print "X",
else:
print char,

Don't delete this print statement!

print


#2

it should work

phrase = "A bird in the hand..."

# Add your for loop

for char in phrase:
    if char.lower()=="a":
        print 'X',
    else:
        print char,



#Don't delete this print statement!
print

#3

Many Thanks

It has worked :smile:


#4

Is char.lower() == 'a' being converted from A to a? I thought the question is look at both use cases for A and a. We can do this way too. I'm just trying to understand the logic. Thank you


#5

Can I know why there is a print statement at the end? I remove that statement and I get an error


#6

this part converts A into a

and this part makes a comparisson if character is "a"
Well, the task was to change A and a into X, you can go both ways.


#7

read the sentence again ,and replace double quote with single one....hope it help..:smile:


#8

yes what is the point of that


#9

nothing will work please help me