We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b72e809 commit 0e50ab7Copy full SHA for 0e50ab7
string_format.py
@@ -0,0 +1,12 @@
1
+def main():
2
+ string = input("String: ")
3
+ print("Lowercase:", string.lower())
4
+ print("Is in title case:", string.istitle())
5
+ # Note for below: position is zero-based, essentially the first letter is position 0
6
+ print("Is the third letter 'a'?", string[2] == 'a')
7
+ position = string.find('e') + 1 # By storing the string.find() result, the code only has to find the position once
8
+ print("Letter 'e' position", "Not present" if position == 0 else position) # Print position if present
9
+
10
11
+if __name__ == "__main__":
12
+ main()
0 commit comments