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-14Input2
python learning
Output 2
16-25-20-8-15-14 12-5-1-18-14-9-14-7Numbers 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.67Given 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
The first line is an integer
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 :
1
2 6
3 7 10
4 8 11 13
5 9 12 14 15