Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. def reverse_print(str):
  2.     new_str = [obj for obj in reversed(str)]
  3.     new_str = "".join(new_str)
  4.     print 'Orginal string: ',first_string
  5.     print 'New_str: ', new_str
  6.  
  7. def search_for_chars(search_str,input_str):
  8.     input_str_reversed = [obj for obj in reversed(input_str)]
  9.     found_chars = []
  10.     not_found = []
  11.     for char in search_str:
  12.         if char in input_str_reversed and " " not in char:
  13.             print 'Before delete',reverse_print(input_str_reversed)
  14.             input_str_reversed.remove(char)
  15.             found_chars.append(char)
  16.             print 'After delete',reverse_print(input_str_reversed)
  17.         else:
  18.             not_found.append(char)
  19.  
  20.     return input_str,input_str_reversed,found_chars,not_found
  21.  
  22.  
  23.  
  24.  
  25.  
  26. first_string = "hej pa dig du fule"
  27. second_string = "idg eluf hej ap"
  28.  
  29.  
  30. input_str,output_str,found_chars,not_found = search_for_chars('hej du',first_string)
  31. print "\n\n\n"
  32. print input_str
  33. reverse_print(output_str)
  34. print 'found_chars: ',found_chars,'\n Not found:',not_found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement