Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

1. Debug(find and correct errors) and run the Python script file Lab X,
2. Analyze the output and interpret what the script is about or does[reading comments may help]
import threading
import time
import random
def myThread(i):
print("Thread {}: started".format(i))
time.sleep(random.randint(1,5))
print("Thread {}: finished".format(i))
def main():
for i in range(4):
thread = threading.Thread(target=myThread, args=(i,))
thread.start()
print("Enumerating: {}".format(threading.enumerate()))
if __name__ == '__main__':
main()
"""In the preceding example, we start off by defining a function called myThread,
which will be the target of the threads that we are about to create.
Within this function, we simply print that the thread has started,
and then we wait for a random interval between 1 and 5 seconds
before printing that the thread is terminating.We have then defined a
main function which creates four distinct thread objects, and then
starts them off.

Create a GUI that allows the user to enter min/max values for Mean Motion. Make a "Find" button that when pressed has the user select an output file and finds satellites with Mean Motion within the specified range and prints them to the screen and writes them to the selected file.


Hollow Right Triangle - 2

Given an integer number 

N as input. Write a program to print the hollow right-angled triangular pattern of N lines as shown below.

Note: There is a space after each asterisk (*) character.

Input

The first line of input is an integer 

N.

Explanation

In the given example the hollow right angled triangle of side 

5. Therefore, the output should be

        *
      * *
    *   *
  *     *
* * * * *
Sample Input 1
4
Sample Output 1
      *
    * *
  *   *
* * * *
Sample Input 2
5
Sample Output 2
        *
      * *
    *   *
  *     *
* * * * *

Hollow Right Triangle

Given an integer number 

N as input. Write a program to print the hollow right-angled triangular pattern of N lines as shown below.

Note: There is a space after each asterisk (*) character.

Input

The first line of input is an integer 

N.

Explanation

In the given example the hollow right angled triangle of side 

4. Therefore, the output should be

* * * *
  *   *
    * *
      *
Sample Input 1
4
Sample Output 1
* * * * 
  *   *
    * *
      *
Sample Input 2
6
Sample Output 2
* * * * * * 
  *       *
    *     *
      *   *
        * *
          *

Perfect Squares in a Range

You are given two given numbers, 

A and B where 1 <= A <= B, Write a program to find the number of perfect squares in the range A to B (including A and B).

Input

The first line of input is an integer 

A. The second line of input is an integer B.

Explanation

In the given example, 

A = 9 and B = 100. The perfect squares in the range A to B are

3 * 3 = 9
4 * 4 = 16
5 * 5 = 25
6 * 6 = 36
7 * 7 = 49
8 * 8 = 64
9 * 9 = 81
10 * 10 = 100

So, the output should be 

8.

Sample Input 1
9
100
Sample Output 1
8
Sample Input 2
625
1444
Sample Output 2
14
Sum of 1 series

Given integer 

N as input. Write a program to print the sum of series 1 + 11 + 111 + .... N terms.

Input

The first line of input is an integer N.

Output

The output should be an integer representing the sum of series.

Explanation

Given 

N = 4

The sum for first 

4 terms is 1 + 11 + 111 + 1111

So the output should be 

1234.

Sample Input 1
4
Sample Output 1
1234
Sample Input 2
5
Sample Output 2
12345

sample input 3
10
sample output3
1234567900
Number of digits until N

Given an integer 

N, write a program that prints the count of the total number of digits between 1 and N.

Input

The input is a positive integer.

Output

The output should be a single line containing the count of the digits up to the given number.

Explanation

Given 

N = 10

From 1 to 9, each number contains a single digit. From 10 onwards, the numbers contain two digits.

So the output should be 9 + 2 = 

11.

Sample Input 1
10
Sample Output 1
11
Sample Input 2
4
Sample Output 2
4

sample input 3
1000
sample output3
2893
Day Name

Given day number 

D as input, write a program to display the day name.

(1 - Monday, 2 - Tuesday, 3 - Wednesday, 4 - Thursday, 5 - Friday, 6 - Saturday, 7 - Sunday)

Input

The first line of input is an integer 

D.

Output

The output should be a string representing the day name. 

Explanation

For example, if 

D = 3 then, according to the day number, the day should be Wednesday.

Sample Input 1
3
Sample Output 1
Wednesday
Sample Input 2
2
Sample Output 2
Tuesday

Compute Hypotenuse

Write a program to find the hypotenuse 

H of a right-angled triangle of sides A and B.

Note: Pythagoras theorem states that, for a right-angled triangle. Hypotenuse2 = A2 + B2

Input

The first line is an integer, 

A. The second line is an integer, B.

Output

The output should be an integer.

Explanation

In the given example, the first side 

A = 3, and the second side B = 4. To calculate the hypotenuse we use Pythagoras theorem.

According to Pythagoras theorem, hypotenuse2 = 32 + 42

Therefore, the hypotenuse value is 

5. So, the output should be 5.

Sample Input 1
3
4
Sample Output 1
5
Sample Input 2
12
5
Sample Output 2
13

Print Integers - 3

Given an integer 

N. Write a program to print integers from N to 1.

Input

The first line of input is an integer 

N.

Explanation

In the given example, 

N = 5 the integers from 5 to 1 are 5, 4, 3, 2, 1.

Therefore, the output should be 

5
4
3
2
1
Sample Input 1
5
Sample Output 1
5
4
3
2
1
Sample Input 2
3
Sample Output 2
3
2
1

LATEST TUTORIALS
APPROVED BY CLIENTS