DEV Community

Discussion on: Python daily exercise 2: string

Collapse
 
jmagave profile image
jmagave

Using integer division operator // instead of /

s = "James"
print(s[0]+s[len(s) // 2]+s[-1:] if  len(s) > 2 else "Too small") 
Enter fullscreen mode Exit fullscreen mode

Caveat emptor, do not handle

Collapse
 
mathewchan profile image
HHMathewChan

your solution looks much better, good to learn from this