### 2018-02-27 HW

posted Feb 27, 2018, 6:23 AM by Samuel Konstantinovich   [ updated Feb 27, 2018, 11:45 AM by Konstantinovich Samuel ]
 Homework: Complete half of Codingbat String-2 (different location): http://codingbat.com/python/String-2(tomorrow you will do the other half!)The last problem is challenging and we will go over it before the next quiz/test)String comparisons: You may use > and < to compare strings! This uses their ASCII value for comparisons."A" < "a"          True"2" > "1"          True"2" > "A"          False"Aa" < "Ab"        True"Zod" < "apple"    TruePython starts by looking at the first character-If they are the same, it looks at the next (repeat this until there is a difference)-If all characters are the same they are equal.(easy case!)-If you run out of characters, and they have been the same so far, the smaller string less than a larger string (no character is less than any character)-If there is a difference, it uses the ASCII value to determine which is larger.ON PAPER:   How do you write an expression that is true when a string variable is a capital letter?Assume:  c is a string of length 1.  Do not use str.upper() or str.lower()def isCaps( c ): return ????Also on paper: Write your own version of str.isalnum() , that accepts a single string as a parameter. You must return true if all of the characters are alpha-numeric, and there is at least one character. False otherwise. There are no assumptions about the length or format of the string. def myisalnum( s)    return ????Classwork:Using IDLE:1. Test your myIsAlNum(s) that you wrote on paper.2. Write myInt(s) that converts an integer formatted string into an int value.Assume: The first character can be a "-" or a digit, all other characters must be digits.There are no leading zeros. (shouldn't matter)Examples:myInt("34") -> 34myInt("0") -> 0myInt("-999") -> -9993. Write a function buildString(s,i) that takes a string and an int.return a new string such that each character of s is repeated i times.example:buildString("Hey",2)   is "HHeeyy"buildString("A!",4)   is "AAAA!!!!"buildString("fish",3)   is "fffiiissshhh"Hint: building a new string is like calculating a sum.-Building a sum starts at 0 and you add values to it.-Building a new string starts empty (just open close quotes "")  and concatenates letters/words to either the start or end of it.Messages:Gur PF-sbepr vf fgebat va guvf bar...Ernq guvf lbh pnaabg... be pna lbh?