← coderbyte_practice

add problem 6,7,8

51829e5694b1f206dcee49f8940ee05be8627dd6 · ovidiucs · May 5, 2015 06:33

+59 · 3 files changed

  • easy/06-letter-capitalize.py +13 −0
  • easy/07-simple-symbols.py +27 −0
  • easy/08-check-nums.py +19 −0
diff --git a/easy/06-letter-capitalize.py b/easy/06-letter-capitalize.py
index e69de29..d74a5aa 100644
--- a/easy/06-letter-capitalize.py
+++ b/easy/06-letter-capitalize.py
@@ -0,0 +1,13 @@
+def LetterCapitalize(str): 
+	return str.title()
+    
+    
+# keep this function call here  
+# to see how to enter arguments in Python scroll down
+print LetterCapitalize(raw_input())           
+"""
+Have the function LetterCapitalize(str) take the str parameter being passed
+and capitalize the first letter of each word. Words will be separated by only one space. 
+"""
+# needs work
+
diff --git a/easy/07-simple-symbols.py b/easy/07-simple-symbols.py
index e69de29..2ab60ff 100644
--- a/easy/07-simple-symbols.py
+++ b/easy/07-simple-symbols.py
@@ -0,0 +1,27 @@
+def SimpleSymbols(str):
+    li = list(str)
+    idx = 0
+
+    while idx+1 < len(li):
+        if li[idx] == '+':
+            idx += 1
+            if li[idx].isalpha():
+                idx +=1
+                if li[idx] == '+':
+                    return "true"
+                else:
+                    return "false"
+        elif li[idx].isalpha():
+            return "false"
+        idx+=1
+
+print SimpleSymbols(raw_input())           
+"""
+Have the function SimpleSymbols(str) take the str parameter
+being passed and determine if it is an acceptable sequence by either returning
+the string true or false. The str parameter will be composed of + and = symbols with several
+letters between them (ie. ++d+===+c++==a) and for the string to be true each
+letter must be surrounded by a + symbol. So the string to the left would be false. 
+The string will not be empty and will have at least one letter. 
+
+"""
diff --git a/easy/08-check-nums.py b/easy/08-check-nums.py
index e69de29..4f42155 100644
--- a/easy/08-check-nums.py
+++ b/easy/08-check-nums.py
@@ -0,0 +1,19 @@
+def CheckNums(num1,num2): 
+
+    if num2 > num1:
+        return 'true'
+    elif num1 == num2:
+        return '-1'
+    else:
+        return 'false'
+
+# keep this function call here  
+# to see how to enter arguments in Python scroll down
+print CheckNums(raw_input())           
+
+"""    
+Have the function CheckNums(num1,num2)
+take both parameters being passed
+and return the string true if num2 is greater than num1,
+otherwise return the string false. 
+If the parameter values are equal to each other then return the string -1. """