Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2019
1,232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. s = 'In a distant, but not so unrealistic, future \
  2.    where mankind has abandoned earth because it has \
  3.    become covered with trash from products sold by \
  4.    the powerful multi-national Buy N Large corporation, \
  5.    WALLE, a garbage collecting robot has been left to \
  6.    clean up the mess. Mesmerized with trinkets of Earth’s \
  7.    history and show tunes, WALLE is alone on Earth except \
  8.    for a sprightly pet cockroach. One day, EVE, a sleek \
  9.    (and dangerous) reconnaissance robot, is sent to Earth to \
  10.    find proof that life is once again sustainable.'
  11.  
  12.     # длина текст
  13.     print(len(s))
  14.     # текст в нижнем регистре
  15.     print(s.lower())
  16.     # Замените все вхождения слова WALLE на WALL-E
  17.     print(s.replace('WALLE', 'WALL-E'))
  18.     # подсчитайте, сколько раз в тексте было использовано слово Earth
  19.     count = 0
  20.     for i in s.split(' '):
  21.         if 'Earth' in i:
  22.             count += 1
  23.     print(count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement