Python Answers

Questions answered by Experts: 5 288

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

Give some examples of
information extraction in NLP.

You are given a positive integer N. Your task is to find the number of positive integers K <= N such that K is not divisible by any of the following numbers 2, 3, 4, 5, 6, 7, 8, 9, 10.

In the given example,

11 is not divisible by any number from 2 to 10. It is divisible by only 1, 11.So, the output should be

2.


Given a MxN matrix, write a program to replace all elements that do not belong to principal-diagonal & anti-diagonal with Zeros.

Principal-diagonal elements are the set of elements of a matrix that lie on the line joining the top left corner to the bottom right corner.

Anti-diagonal elements are the set of elements of a matrix that lie on the line joining the bottom left corner to the top right corner.Input


The first line of input will contain two space-separated integers, denoting MxN matrix.

The next M lines will contain N space-separated integers.Output


The output should be MxN matrix by replacing elements that do not belong to principal-diagonal and anti-diagonal with Zeros. Print each row as a space separated integers in a single line.

input:5 5

4 3 7 6 4

4 4 7 7 6

9 5 8 5 9

3 6 6 2 4

3 7 4 4 3

output should be like this:4 0 0 0 4

0 4 0 7 0

0 0 8 0 0

0 6 0 2 0

3 0 0 0 3


Given an integer N as a starting number and K as input, write a program to print a number pyramid of K rows as shown below.

In the example, the given starting number is

10, and the number of rows in the pyramid is 5.So, the output should be

24 

23 22 

21 20 19 

18 17 16 15 

14 13 12 11 10


Given a sentence S, write a program to print the frequency of each word in S. The output order should correspond with the word's input order of appearance.

Temperature Conversion:-

You are given the temperature T of an object in one of Celsius, Fahrenheit, and Kelvin scales.

Write a program to print T in all scales viz Celsius, Fahrenheit, and Kelvin.

Formula to convert from Fahrenheit F to Celsius C is C = (F - 32) * 5 / 9.

Formula to convert from Kelvin K to Celsius C is C = K - 273.

Here "C", "F", "K" represent that the temperature scale is in Celsius, Fahrenheit and Kelvin scales respectively.

The input contains the temperature (a number) and the unit of the temperature scale (C, F, K) without any space.

The output contains temperature in Celsius, Fahrenheit and Kelvin scales in each line in the format similar to input and the value of the temperature is rounded to 2 decimal places.


Given a sentence S, write a program to print the frequency of each word in S. The output order should correspond with the word's input order of appearance.

Largest Palindrome

You are given an integer

N. Find the largest palindrome which is less than N.Input

The input contains a single integer

N.Output

The output should be a single integer which is the largest palindrome that is less than the given input.

Explanation

Given

N = 45.44 is the largest number which is a palindrome that is less than 45.


Write a program to count Vowels and Consonants in string.


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.


LATEST TUTORIALS
APPROVED BY CLIENTS