For example, this simple code for outputting the middle character of a word - if it has a middle character.
string = str(input("String: "))
print(list(letter for letter in string if letter == string[((len(string) - 1) // 2)]))
Could I have the input inside of the list comp whilst still being able to reference the length of it in another part? Usually I do something like this with my inputs in list comp:
print(''.join(str(y) for y in [x for x in str(input("Please enter a string: "))
if x.isnumeric() == False]))
Just wanting to learn more about list comp's possibilities.