In: Computer Science
1)Given a list L1, create a list L2 that contains all but the last element of L1 (e.g. if L1 is ["a","z",True], L2 should be equal to ["a","z"]
2)Given a string s, assign a variable has_z that is True if s contains the letter "z" anywhere within it.
3)Write Python code that calculates the mean of a given list of numbers x and saves the result in a variable m.
4)Given two numeric variables, x and y, assign the maximum of x and y to a variable m.
5)given a string s, write Python code that sets a boolean variable has_two_caps to True if the string contains exactly two capital letters (use the .isupper() string method to test individual letters) and False otherwise.
6)Given two variables x and y containing numerical values and a boolean variable use_x, assign a third variable z the value of x if use_x is True; assign it the value of y if use_x is False.
7)Given a list of logical values x, set all_x to True if all of the values in x are True, and False otherwise
IN PYTHON!!
def part_one(l):
   return l[:len(l)-1]
def part_two(s):
   return ('z' in s) or ('Z' in s)
def part_three(l):
   return sum(l)/len(l)
def part_four(x,y):
   return x if x > y else y
def part_five(s):
   count = 0
   for x in s:
       if count >= 2:
           return
True
       elif x.isupper():
           count = count +
1
   # for last digit
   if count >= 2:
       return True
   else:
       return False
def part_six(x,y,use_x):
   return x if use_x else y
def main():
   print("Part One")
   l = eval(input("Enter your list: "))
   print(part_one(l))
   print("\nPart Two")
   s = input("Enter s: ")
   has_z = part_two(s)
   print("has_z: ",has_z)
   print("\nPart Three")
   l = eval(input("Enter list for sum: "))
   m = part_three(l)
   print("m: ",m)
   print("\nPart Four")
   x = float(input("Enter x : "))
   y = float(input("Enter y : "))
   m = part_four(x,y)
   print("m: ",m)
   print("\nPart Five")
   s = input("Enter s: ")
   has_two_caps = part_five(s)
   print("has_z: ",has_two_caps)
   print("\nPart Six")
   x = float(input("Enter x: "))
   y = float(input("Enter y: "))
   use_x = eval(input("Enter use_x: "))
   z = part_six(x,y,use_x)
   print("z: ",z)
main()


