Question

In: Computer Science

Python Review in class Worksheet You are working with your friends, El, Mike, Will, Lucas and...

Python Review in class Worksheet

  1. You are working with your friends, El, Mike, Will, Lucas and Dustin. You are watching the lights in Will’s house flicker on and off and you notice patterns. All of you think it’s a code. So you count the repeating set of flickers, but sometimes you miss the dark count.

38 seconds, light stays steady, 95 seconds light stays steady, Dark for 19 seconds

The flickers change

60 seconds flickers, light stays steady, 160 seconds flickers light stays steady, dark 20 seconds

              The flickers change

              54 seconds flickers, light stays steady, 126 seconds flickers light stays steady, dark 18 seconds

              The flickers change

              11 seconds flickers, light stays steady, 111 seconds flicker light stays steady, dark ___ seconds

              The flickers change

              28 seconds flickers, light stays steady, 70 seconds flickers light stays steady, dark __ seconds

              The flickers change

              21 seconds flickers, light stays steady, 56 seconds flickers light stays steady, dark 7 seconds

              The flickers change

              5 seconds flickers, light stays steady, 50 seconds flickers light stays steady, dark __ seconds

              The flickers change

              18 seconds flickers, light stays steady, 180 seconds flickers light stays steady, dark   __ seconds

              The flickers change

              60 seconds flickers, light stays steady, 160 seconds flickers light stays steady, dark 20 seconds

              The flickers change

              40 seconds flickers, light stays steady, 72 seconds flickers light stays steady, dark __ seconds

              The flickers change

              36 seconds flickers, light stays steady, 27 seconds flickers light stays steady, dark 9 seconds

              The flickers change

              28 seconds flickers, light stays steady, 70 seconds flickers light stays steady, dark 14 seconds

The flickers change

              21 seconds flickers, light stays steady, 56 seconds flickers light stays steady, dark __ seconds

              The flickers change

38 seconds, light stays steady, 95 seconds light stays steady, Dark for 19 seconds

A terrible sizzling is heard and the smell of electrical smoke, and all the lights go out and stay that way.

Figure out the pattern, then write a python program to calculate the missing Darks and then print out the result of the code.

A   B C D E F G H I   J    K   L M   N O P   Q   R    S   T   U   V   W   X Y   Z

Solutions

Expert Solution

Raw_code:

def dark(light1, light2):
remainder = light2 % light1
difference = light1 - remainder
print("{0:1d} seconds flickers, light stays steady,"
" {1:1d} seconds flickers, light stays steady".format(light1, light2), end = " ")
if remainder == difference:
print("dark :", difference)
elif remainder < difference:
print("dark :", remainder)
elif difference < remainder:
print("dark: ", difference)

dark(38, 95)
dark(60, 160)
dark(54, 126)
dark(11, 111)
dark(28, 70)
dark(21, 56)
dark(5, 50)
dark(18, 180)
dark(60, 160)
dark(40, 72)
dark(36, 27)
dark(28, 70)
dark(21, 56)
dark(38, 95)


Related Solutions

IN PYTHON ( Use Fuctions and or with Loop if comfortable) Your friends just bought a...
IN PYTHON ( Use Fuctions and or with Loop if comfortable) Your friends just bought a new five room house and need your help to know how much it will cost to re-do the floors. Write a program that, given the dimensions of each of the five rooms and the desired type of flooring, outputs the cost of each room as well as the total cost. Hardwood costs $1.39/sqft, carpet costs $3.99/sqft, and tile costs $4.99/sqft. Input Validation: Your program...
Given: You are given a Python Class template. In this class there is a class variable...
Given: You are given a Python Class template. In this class there is a class variable vector, is a list of N non-negative integers and are stored (in positions 0, 1, 2, ... (N-1)), where at least one integer is 0. Task: Write a recursive function "findAllPaths" to find all possible path through V starting at position 0, and ending at the location of 0, in accordance with the Rule below. If no such path exists, "paths" should be an...
In the Benefits vs. Costs worksheet, you looked at how friends might exchange rewards in a...
In the Benefits vs. Costs worksheet, you looked at how friends might exchange rewards in a relationship. This exchange might occur more easily when friends live near one another, and would occur based on the proximity-attraction principle as we choose friends from those who live close by. However, technology has changed this pattern to some extent, giving us the ability to socialize easily from great distances. List three proximal friendships and three distant friendships and describe how you stay in...
Your grandma wants to review the distribution of the ages of her Facebook friends. The ages...
Your grandma wants to review the distribution of the ages of her Facebook friends. The ages of a sample of her 20 Facebook friends are as follows: 61 77 38 49 53 39 70 56 62 65 53 69 56 71 61 73 59 34 50 46 a.         Construct a frequency, relative frequency, and cumulative relative frequency distribution for the data, using five class intervals. Please use the value 30 as the lower limit of the first class, and the...
Your good friends, Pistol Pete and his wife Petunia found out that you took this class....
Your good friends, Pistol Pete and his wife Petunia found out that you took this class. They now know you are an expert on Personal Finance and would like your advice. They invite you over for dinner to talk about their situation. Pete has been offered an amazing career opportunity. He is considering leaving his job as the Aggie mascot and moving to Miami, Florida to become the next “Billy the Marlin,” a Major League Baseball Team Mascot. Petunia is...
Working in teams of five, think of a product or service your friends want but cannot...
Working in teams of five, think of a product or service your friends want but cannot get on or near campus. You might ask your friends at other schools what’s available there. What kind of product would fill that need? Discuss your results in class and how you might go about marketing that new product or service.
Mike, your buddy in QMB 2301, does not go to class often. Before the exam, he...
Mike, your buddy in QMB 2301, does not go to class often. Before the exam, he wants to study with you. You try to teach him the concept of quantitative and categorical data. He says: “Any categorical data can be converted to quantitative data by just assigning a number to it. Likewise, any numerical data can be converted to categorical data by just spelling out the words of the numbers.” Explain why Mike is wrong.
Name your program file warmup.py Submit your working Python code to your CodePost.io account. In this...
Name your program file warmup.py Submit your working Python code to your CodePost.io account. In this challenge, establish if a given integer num is a Curzon number. If 1 plus 2 elevated to num is exactly divisible by 1 plus 2 multiplied by num, then num is a Curzon number. Given a non-negative integer num, implement a function that returns True if num is a Curzon number, or False otherwise. Examples is_curzon(5) ➞ True 2 ** 5 + 1 =...
When you decide to go and have a dinner with your friends in a world class hotel such as the Langham hotel or Coronado Beach
  When you decide to go and have a dinner with your friends in a world class hotel such as the Langham hotel or Coronado Beach, perhaps you would be horrified by the high price you would have to pay for a bottle of soft drink such as Coca Cola or Pepsi Cola or wine or even bottled water. Perhaps you begin to ponder why the same commodity that you can get at a supermarket at one tenth the hotel...
When you decide to go and have a dinner with your friends in a world class hotel such as the Langham hotel or Coronado Beach
  When you decide to go and have a dinner with your friends in a world class hotel such as the Langham hotel or Coronado Beach, perhaps you would be horrified by the high price you would have to pay for a bottle of soft drink such as Coca Cola or Pepsi Cola or wine or even bottled water. Perhaps you begin to ponder why the same commodity that you can get at a supermarket at one tenth the hotel...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT