-
Notifications
You must be signed in to change notification settings - Fork 367
Expand file tree
/
Copy pathCamel_Case.py
More file actions
27 lines (25 loc) · 812 Bytes
/
Camel_Case.py
File metadata and controls
27 lines (25 loc) · 812 Bytes
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
#Name : Atul Kumar
#Github username : atul1510
#Repositary name : Algorithms
#Problem Description
#Program to convert text sentence in CamelCase format .
#Examples:
#1] INPUT: "this is camel case"
#OUTPUT "thisIsCamelCase"
#2] INPUT: "Hi Atul here"
# OUTPUT: "hiAtulHere"
#Example Explanation
# Main Function
def main():
N = (int(input("No of TestCases : ")))
for _ in range(N):
S = input("Enter a sentence : ")
print("Original: {}".format(S))
S = S.title() #Convert the first only the first letter of a word to uppercase and rest all to lowercase
S = S.split() #Generates a list of words
S[0] = S[0].lower()
S = "".join(S) #Joins all the words
print("Camel Casing : {}".format(S))
print()
if __name__=="__main__":
main()