This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | :root{ | |
| box-sizing: border-box; | |
| } | |
| *, ::before, ::after { | |
| box-sizing: inherit; | |
| } | |
| * {margin: 0 } | |
| body { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ''' | |
| Write a function that takes a list or tuple of numbers. Return the result of alter- | |
| nately adding and subtracting numbers from each other. So calling the func- | |
| tion as plus_minus([10, 20, 30, 40, 50, 60]) , you’ll get back the result of | |
| 10+20-30+40-50+60 , or 50 | |
| ''' | |
| # This is a somewhat ineffective solution | |
| def plus_minus(my_list): | |
| st = '' | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def even_odd_sums(my_list): | |
| odd = 0 | |
| even = 0 | |
| for x in range(len(my_list)): | |
| if x % 2 == 0: | |
| even += my_list[x] | |
| else: | |
| odd += my_list[x] | |
| return [even, odd] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def transposer(list_of_strings): | |
| return [" ".join(y[z] for y in [x.split() for x in list_of_strings]) for z in range(len(list_of_strings))] | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import string | |
| def is_pangram(sentence): | |
| return set(x for x in sentence.lower() if x in string.ascii_lowercase) == set(string.ascii_lowercase) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Matrix: | |
| def __init__(self, matrix_string): | |
| self.matrix = [[int(x) for x in row.split(" ")if x.isdigit() == True] for row in matrix_string.splitlines()] | |
| def row(self, index): | |
| return self.matrix[index -1] | |
| def column(self, index): | |
| return [x[index-1] for x in self.matrix ] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def pig_latin(word): | |
| if word[:1] in ('a', 'e', 'i', 'o', 'u'): | |
| return word + 'way' | |
| return word[1:] + word[:1] + 'ay' | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name = input('What is your name: ') | |
| name_list = '' | |
| for character in name: | |
| name_list += character | |
| print(name_list) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def chopNumber(float_number, before_int, after_int): | |
| # Chop before | |
| str_truncate = str(int(float_number)) | |
| str_truncate = str_truncate[-before_int:] | |
| str_float = float(str_truncate) | |
| # Chop after | |
| number_dec = float_number - int(float_number) | |
| number_dec = str(number_dec) | |
| number_dec = number_dec[0:after_int+2] | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def sumOfOnes(num): | |
| return len([i for i in bin(num) if i == "1"]) | |
| def countOnes(left, right): | |
| return sum([sumOfOnes(i) for i in range(left, right+1)]) | |
NewerOlder