add problem 6,7,8
+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
@@ -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 + @@ -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. + +""" @@ -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. """