spam = 'Say hi to Bob\'s mother.'
print(spam)
print("Hello there!\nHow are you?\nI\'m doing fine.")
print(r'That is Carol\'s cat.')
print('''Dear Alice
Eve's cat has been arrested for catnapping, cat burglary, and extortion.
Sincerely,
Bob''')
spam = 'Hello world!'
print(spam[0])
print(spam[4])
print(spam[-1])
print(spam[0:5])
print(spam[6:])
spam = 'Hello world!'
fizz = spam[0:5]
print(fizz)
print(spam)
print('Hello' in 'Hello World!')
print('Hello' in 'Hello')
print('HELLO' in 'Hello World!')
print('cats' not in 'cats and dogs')
spam = 'Hello World!'
spam = spam.upper()
print(spam)
spam = spam.lower()
print(spam)
print('How are you?')
feeling = input()
if feeling.lower() == 'great':
print('I feel great too.')
else:
print('I hope the rest of your day is good.')
spam = 'Hello world!'
print(spam.islower())
print(spam.isupper())
print('Hello'.isupper())
print('abc12345'.islower())
print('12345'.islower())
print('12345'.isupper())
print('Hello'.upper())
print('Hello'.upper().lower())
print('Hello'.upper().lower().upper())
print('HELLO'.lower())
print('HELLO'.lower().islower())
print('hello'.isalpha())
print('hello123'.isalpha())
print('hello123'.isalnum())
print('hello'.isalnum())
print('123'.isdecimal())
print(' '.isspace())
print('This Is Title Case'.istitle)
print('This Is Title Case 123'.istitle)
print('This Is not Title Case'.istitle)
print('This Is NOT Title Case Either'.istitle)
while True:
print('年齢を入力してください')
age = input()
if age.isdecimal():
break
print('年齢は数字で入力してください')
while True:
print('新しいパスワードを入力してください')
password = input()
if password.isalnum():
break
print('パスワードは英数字で入力してください')
print('Hello world!'.startswith('Hello'))
print('Hello world!'.endswith('world!'))
print('abc123'.startswith('abcdef'))
print('abc123'.endswith('12'))
print('Hello world!'.startswith('Hello world!'))
print('Hello world!'.endswith('Hello world!'))
print(', '.join(['cats', 'rats', 'bats']))
print(' '.join(['My', 'name', 'is', 'Simon']))
print('ABC'.join(['My', 'name', 'is', 'Simon']))
print('My name is Simon'.split())
print('MyABCnameABCisABCSimon'.split('ABC'))
print('My name is Simon'.split('m'))
spam = '''Dear Alice,
How are you been? I am fine.
There is a container in the fridge
that is labeled "Milk Experiment".
Please do not drink it.
Sincerely,
Bob'''
print(spam.split('\n'))
from turtle import left
print('Hello'.rjust(10))
print('Hello'.rjust(20))
print('Hello World!'.rjust(20))
print('Hello'.ljust(10))
print('Hello'.rjust(20, '*'))
print('Hello'.ljust(20, '-'))
print('Hello'.center(20, '='))
def print_picnic(items_dict, left_width, right_width):
print('PICNIC ITEMS'.center(left_width + right_width, '-'))
for k, v in items_dict.items():
print(k.ljust(left_width, '.') + str(v).rjust(right_width))
picnic_items={'sandwiches': 4, 'apples': 12, 'cups': 4, 'cookies': 8000}
print_picnic(picnic_items, 12, 5)
print_picnic(picnic_items, 20, 6)
spam=' Hello World '
print(spam.strip())
print(spam.lstrip())
print(spam.rstrip())
spam='SpamSpamBaconSpamEggsSpamSpam'
print(spam.strip('ampS'))
import pyperclip
pyperclip.copy('Hello world!')
pyperclip.paste()