From b7e9dc4fbdd1ec987b0fa559bb813ebe0f3a340b Mon Sep 17 00:00:00 2001 From: Hemant Rana <38358739+Hemant-60@users.noreply.github.com> Date: Sun, 13 Oct 2019 19:27:45 +0530 Subject: [PATCH 1/3] Challange-1 --- Hemant-60/c1.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Hemant-60/c1.py diff --git a/Hemant-60/c1.py b/Hemant-60/c1.py new file mode 100644 index 0000000..8515cf0 --- /dev/null +++ b/Hemant-60/c1.py @@ -0,0 +1,41 @@ +def print_without_spaces(some_str): + flag = 0 + other_str="" + for i in some_str: + if flag == 0 and i!=" ": + other_str+=i + elif i==" ": + flag=1 + elif flag==1 and i!=" ": + flag=0 + i=i.upper() + other_str+=i + + return other_str +def print_with_spaces(some_str): + flag=0 + other_str="" + for i in some_str: + if i>="A" and i<="Z": + flag=1 + + if flag==0 and i!=" ": + other_str+=i + + + if flag == 1: + i=i.lower() + flag=0 + other_str+=" " + other_str+=i + + other_str = other_str[1].capitalize()+other_str[2:] + + return other_str + + +some_str=input("Enter the string : ") +some_str=print_without_spaces(some_str) +print(some_str) +print(print_with_spaces(some_str)) + From 8ae812f3d7a0bd845b6a2f86e507e90d7e3abb0f Mon Sep 17 00:00:00 2001 From: Hemant Rana <38358739+Hemant-60@users.noreply.github.com> Date: Sun, 13 Oct 2019 19:28:31 +0530 Subject: [PATCH 2/3] Delete c1.py --- Hemant-60/c1.py | 41 ----------------------------------------- 1 file changed, 41 deletions(-) delete mode 100644 Hemant-60/c1.py diff --git a/Hemant-60/c1.py b/Hemant-60/c1.py deleted file mode 100644 index 8515cf0..0000000 --- a/Hemant-60/c1.py +++ /dev/null @@ -1,41 +0,0 @@ -def print_without_spaces(some_str): - flag = 0 - other_str="" - for i in some_str: - if flag == 0 and i!=" ": - other_str+=i - elif i==" ": - flag=1 - elif flag==1 and i!=" ": - flag=0 - i=i.upper() - other_str+=i - - return other_str -def print_with_spaces(some_str): - flag=0 - other_str="" - for i in some_str: - if i>="A" and i<="Z": - flag=1 - - if flag==0 and i!=" ": - other_str+=i - - - if flag == 1: - i=i.lower() - flag=0 - other_str+=" " - other_str+=i - - other_str = other_str[1].capitalize()+other_str[2:] - - return other_str - - -some_str=input("Enter the string : ") -some_str=print_without_spaces(some_str) -print(some_str) -print(print_with_spaces(some_str)) - From dc371b1e8567c1dab338965544d41d6f32288010 Mon Sep 17 00:00:00 2001 From: Hemant Rana <38358739+Hemant-60@users.noreply.github.com> Date: Sun, 13 Oct 2019 19:29:12 +0530 Subject: [PATCH 3/3] challange-1 --- Challenge questions/Hemant-60/c1.py | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Challenge questions/Hemant-60/c1.py diff --git a/Challenge questions/Hemant-60/c1.py b/Challenge questions/Hemant-60/c1.py new file mode 100644 index 0000000..8515cf0 --- /dev/null +++ b/Challenge questions/Hemant-60/c1.py @@ -0,0 +1,41 @@ +def print_without_spaces(some_str): + flag = 0 + other_str="" + for i in some_str: + if flag == 0 and i!=" ": + other_str+=i + elif i==" ": + flag=1 + elif flag==1 and i!=" ": + flag=0 + i=i.upper() + other_str+=i + + return other_str +def print_with_spaces(some_str): + flag=0 + other_str="" + for i in some_str: + if i>="A" and i<="Z": + flag=1 + + if flag==0 and i!=" ": + other_str+=i + + + if flag == 1: + i=i.lower() + flag=0 + other_str+=" " + other_str+=i + + other_str = other_str[1].capitalize()+other_str[2:] + + return other_str + + +some_str=input("Enter the string : ") +some_str=print_without_spaces(some_str) +print(some_str) +print(print_with_spaces(some_str)) +