can someone explain this in details
GermanTs (0)

i made research and find this kind of code from google for my project. im newbie in python so can someone help me and explain this in details?

You are viewing a single comment. View All
malvoliothegood (728)
# Get text string input from the user and store it in a variable called "var"
var = input('any: ')
# Find how many characters there are in "var"
lenght = len(var)
# Find the index value of the middle of the string
middle = int(lenght / 2)
# If the numbers of characters in "var" is even display the middle two characters 
if lenght % 2 == 0:
  print(var[middle-1 :middle+1])
else: # Display the middle chacter
  print(var[middle :middle+1])

Read more:

GermanTs (0)

@malvoliothegood thanks ! that was so helpful .