How to process capitalisation in words

I tried to solve this problem but don’t know how to, I would appreciate it if you could help me.

If the paint colour label contains the string ‘blue’ with any capitalisation, your program should say: ‘Excellent! We’ll soon have enough paint for the sky!’

I need to know how how to make the code register the capitalisation of the word ‘blue’

colour = input ('Which colour did you find? ')
number_of_tins = int(input('Number of tins: '))
if 'blue' in colour:
  print ("Excellent! We'll soon have enough paint for the sky!")

thank you

>Solution :

Strings have a few methods to help you out, namely lower and upper. Typically lower is used in cases like this. It returns a new string of each letter in lowercase or uppercase respectively. So you can simply compare ‘blue’ to colour.lower()

Leave a Reply