# Computing and programming (coding) | Computer Science homework help

Q1:  A design task involves finding values for three variables. Each variable can take two values. How many solutions are possible? If each solution requires 1 second to be evaluated on a computer, how long does it take to evaluate all solutions? If the number of variables increases to 30, how long does it take to evaluate all solutions?Show your work.Q2: In sorting, stability is defined as the ability of a sorting algorithm to preserve the relative order of equal keys in a file. See illustration below.Comment on the stability of insertion sort and selection sort. Explain why they are stable or non-stable. Q3: Explain the difference between a compiler and an interpreter with your own words Q4:Complete the following Python exercises and include screenshots of your code and execution.

• Include      a screenshot of the execution of a simple line of code (e.g., print(“Hello      World”)) on a Python installation on your machine.
• Write a program to prompt the user      for hours and rate per hour to compute gross pay.
• Rewrite your pay computation to      give the employee 1.5 times the hourly rate for hours worked above 40      hours.

Q5  Write a program to prompt for a score between 0.0 and 1.0. If the score is out of range, print an error message. If the score is between 0.0 and 1.0, print a grade using the following table:Score Grade>= 0.9 A>= 0.8  B>= 0.7 C>= 0.6 D< 0.6 FQ6: Write a program which repeatedly reads numbers until the user enters “done”. Once “done” is entered, print out the total, count, and average of the numbers. If the user enters anything other than a number, detect their mistake using try and except and print an error message and skip to the next number.
Enter a number: 4Enter a number: 5Enter a number: bad dataInvalid inputEnter a number: 7Enter a number: done16 3 5.333333333333333
Q7:  Take the following Python code that stores a string:`str=”X-DSPAM-Confidence:0.8475″Use find and string slicing to extract the portion of the string after the colon character and then use the float function to convert the extracted string into a floating point number.