forked from Akuli/python-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring-practice.py
More file actions
48 lines (41 loc) · 1.17 KB
/
string-practice.py
File metadata and controls
48 lines (41 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# my_string = "Hello World hello"
#
# print(my_string[-7:-2])
#
# print(my_string[-1])
#
# print(my_string.upper(), my_string.capitalize(), my_string.lower(), my_string.replace("o", "0", 2))
#
# print(my_string.rindex('o'))
#
# print(my_string.upper()[3:].startswith('L'))
# name = 'Cookie'
# print("Hello {}.".format(name))
# print("Hello %s." % name)
# print(f"Hello {name}.")
# print("C" in name)
# print("Hello" in name)
# print(len(name))
# print(str(42))
# print(float("42.44"))
# print(int("42"))
# Exercise
# print("Hello!")
# word1 = input("Enter something: ")
# word2 = input("Enter another thing: ")
# word3 = input("Enter a third thing: ")
# word4 = input("And yet another thing: ")
# # Usable everywhere
# print("You entered %s, %s, %s, %s." % (word1, word2, word3, word4))
# print("You entered {}, {}, {}, {}.".format(word1, word2, word3, word4))
# # Only usable in Python 3.6
# print(f"You entered {word1}, {word2}, {word3}, {word4}.")
message = input("What do you want me to say? ")
message = message.upper()
print(message, "!!!")
print(message, "!!!")
print(message, "!!!")
if message[::-1] == message:
print("It's a palindrome!")
else:
print("It's not a palindrome")