New to python and working on lists. The items in my lists consists of letters and numbers, and I’m wondering how to print the letters in uppercase. This is what I have.
dirtbike = ['yz450', 'kx450', 'rmz450', 'ktm450', 'fc450']
message = f"I would love to own a {dirtbike[0]}! As well as a {dirtbike[1]}!"
print(message)
I would like the print out to be ‘YZ450’ & ‘KX450’ but have only managed to print the whole message in upper using message.upper
>Solution :
You can use the method upper inside the brackets.
message = f"I would love to own a {dirtbike[0].upper()}! As well as a {dirtbike[1].upper()}!"