dimanche 3 février 2019

Trying to detect wether a variable/string is mixed case in Python

I'm trying to write a simple program that detects wether or not a string is upper case, lower case or mixed case.

I tried x.ismixed but it doesn't work

I have also tried x == mixed.case

This is the code:

x = input('Loud: ')

if x.isupper():
  print("Quiet:", x.lower())

elif x.ismixed():
  print (x.lower)

else:

  print (x.lower)

The error code comes up with

built-in method lower of str object at 0xf70445e0

The output should be x.lower() but instead comes up with the code above.

Output/example: HEllO ThEre to hello there.

Aucun commentaire:

Enregistrer un commentaire