-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·39 lines (15 loc) · 1.54 KB
/
main.py
File metadata and controls
executable file
·39 lines (15 loc) · 1.54 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
# Let's use some methods to manipulate the string stored in name.
name = "John Jacob Jingleheimer Schmidt"
# 1. Use print and a built-in method to print out the string "jOHN jACOB jINGLEHEIMER sCHMIDT"
# 2. Use print and a built-in method to print out the string "JOHN JACOB JINGELHEIMER SCHMIDT"
# 3. Use print and a built-in method to count how many times the letter i is in Mr. Schmidt's name.
# 4. Use print and a built-in method to print out Mr. Schmidt's name, but with all the instances of the letter i removed or deleted.
# 5. Use print and a built-in function to find out how many characters are in Mr. Schmidt's name.
## NOTE that since this is a function and not a method, the best solution won't be on the string methods page - you'll need to Google this one.
# 6. Use a built-in method to replace every letter J with the letter G instead. Bonus point if you can say the result out loud without laughing.
# 7. Chain a few methods together to print out the string with all the vowels removed.
# 8. Try to print the name as four separate strings by using a method that will split it up like this: ["John", "Jacob", "Jingleheimer", "Schmidt"]
# 9. Print out only the first four letters of the string.
# 10. Print out only the first ten letters of the string but make them all uppercase.
# 11. CHALLENGE: Try to print out the string "tdimhcS remiehelgniJ bocaJ nhoJ" (which is the name backwards)
# 12. CHALLENGE: Chain two methods together to print out the string "TDIMHCS REMIEHELGNIJ BOCAJ NHOJ", (which is the name in uppercase and backwards).