0

Trying to say in my code that if middle_name is an empty string then print, else if it has been inputted then print the second way.

What's the best way to word my if statement?

first_name = input()
middle_name = input()
last_name = input()

first_initial = first_name[0:1]
middle_initial = middle_name[0:1]
  
      
if middle_name != str:
    print((last_name + ','), first_initial)
else:   
    print(last_name,(first_initial + '.' + middle_initial + '.'))
Franco Morero
  • 549
  • 5
  • 20
  • 1
    Does this answer your question? [How to check if the string is empty?](https://stackoverflow.com/questions/9573244/how-to-check-if-the-string-is-empty) – greenjaed May 13 '21 at 20:43
  • @greenjaed yes thank you, I ended up scrapping this idea and went with something different, but thank you anyways – Tommy Kirby May 18 '21 at 11:17

0 Answers0