Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2.  
  3. def Module(text):
  4. result=""
  5. symbol='|'
  6. first_appearance=text.find(symbol)
  7. second_appearance=text[first_appearance+1:].find(symbol)
  8. for index in range(len(text)):
  9. if index==first_appearance:
  10. result+="abs("
  11. elif index==second_appearance:
  12. result+=")"
  13. elif text[index]==',':
  14. result+='.'
  15. else:
  16. result+=text[index]
  17. return result
  18. print(Module('|-123,123|'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement