This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message = "Hello World" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message1 = 'hello' + ' ' + 'world' | |
print message1 | |
-> hello world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message2a = 'hello ' * 3 | |
message2b = 'world' | |
print message2a + message2b | |
-> hello hello hello world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message3 = 'howdy' | |
message3 += ' ' | |
message3 += 'world' | |
print message3 | |
-> howdy world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message4 = 'hello' + ' ' + 'world' | |
print len(message4) | |
-> 11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message5 = "hello world" | |
message5a = message5.find("worl") | |
print message5a | |
-> 6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message6 = "Hello World" | |
message6b = message6.find("squirrel") | |
print message6b | |
-> -1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message7 = "HELLO WORLD" | |
message7a = message7.lower() | |
print message7a | |
-> hello world |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message8 = "HELLO WORLD" | |
message8a = message8.replace("L", "pizza") | |
print message8a | |
-> HEpizzapizzaO WORpizzaD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
message9 = "Hello World" | |
message9a = message9[1:8] | |
print message9a | |
-> ello Wo |