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

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
* * * * * * 
  *       *
    *     *
      *   *
        * *
          *


write a program to print the values as given in output

input: [1, 2, 3, 4, [8, 7, 6, 5], 9, 10, 11, 12, [16, 15, 14, 13], 17, 18, 19, 20, [22, 22, 21, 20]]

output : 1,2,3,4,8,7,6,5,9,10,11,12,16,15,14,13,17,18,19,20,22,22,21,20


Largest Number in the List:

You are given space-separated integers as input. Write a program to print the maximum number among the given numbers.


Product of Elements in the List:

You are given a space-separated list of integers as input. Write a program to print the product of these numbers.


Add two polynomials

Given two polynomials A and B, write a program that adds the given two polynomials A and B.Input


The first line contains a single integer M.

Next M lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes co-efficient of Pi for polynomial A.

After that next line contains a single integer N.

Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.Output


Print the addition of polynomials A and B.

The format for printing polynomials is: Cix^Pi + Ci-1x^Pi-1 + .... + C1x + C0, where Pi's are powers in decreasing order, Ci is co-efficient and C0 is constant, there will be space before and after the plus or minus sign.




Input 2

4

0 5

1 0

2 10

3 6

4

0 -5

1 0

2 -10

3 -6


output





Secret Message - 2

Given a string, write a program to print a secret message that replaces characters with numbers 'a' with 1, 'b' with 2, ..., 'z' with 26 where characters are separated by '-'.


Note: You need to replace both uppercase and lowercase characters. You can ignore replacing all characters that are not letters.


abcdefghij12345678910

klmnopqr1112131415161718

stuvwxyz1920212223242526Input


The input will be a string in the single line containing spaces and letters (both uppercase and lowercase).Output


The output should be a single line containing the secret message. All characters in the output should be in lower case.Explanation



Input 1

python

Output 1

16-25-20-8-15-14


Input2

python learning

Output 2

16-25-20-8-15-14 12-5-1-18-14-9-14-7





Numbers in String - 1

Given a string, write a program to return the sum and average of the digits of all numbers that appear in the string, ignoring all other characters.Input


The input will be a single line containing a string.Output


The output should contain the sum and average of the digits of all numbers that appear in the string.

Note: Round the average value to two decimal places.Explanation


For example, if the given string is "I am 25 years and 10 months old", the digits of all numbers that appear in the string are 2, 5, 1, 0. Your code should print the sum of all digits(8) and the average of all digits(2.0) in the new line.


Input 1

I am 25 years and 10 months old

Output 1

8

2.0


Input 2

Anjali25 is python4 Expert


Output 2

11
3.67

Given a student has scored

M marks in Maths, P marks in Physics and C marks in Chemistry. Write a program to check if a student is eligible for admission in a professional course. If any one of the below conditions is satisfied, then the student is eligible.1) M >= 70 and P >= 60 and C >= 60

2) M + P + C >= 180

Input

The first line is an integer

M, the second line is an integer P, and the third line is an integer C.Output

The output should be a single line containing

True if it satisfies the given conditions, False in all other cases.


Given N and need print the pattern given below


input:

N = 5

output :

2 6 

3 7 10

4 8 11 13

5 9 12 14 15


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
def myThread():
print("Thread {} starting".format(threading.currentThread().getName()))
time.sleep(10)
print("Thread {} ending".format(threading.currentThread().getName()))
for i in range(4):

"""In the preceding code,a function myThread is defined. Within this function,
we utilize the threading.currentThread().getName()
in order to retrieve the current thread’s moniker, a
nd print this out both when we start our thread’s execution, and when it ends.
We then go on to start a for loop, and create four thread objects that take in
the name parameter, which we define as “Thread-” + str(i), as well as
the myThread function as the target of that thread’s execution.
We then, finally, go on to print out all the active threads currently running.
"""
LATEST TUTORIALS
APPROVED BY CLIENTS