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

given a list of M numbers and a positive integer N, print the sum of numbers whose position in the list is divisible by N .consider that the position of numbers range from 1 to N

INPUT:

the first line contains two space-separated integers N, M

the second line contain M space-separated integers.

output:

print a single integer representing the required sum

explanation:

Sample Output1

Given N=1 , M=7

and the number list = [4,8,6,6,7,9,3]

As every position is divisible by 1,

4+8+6+6+7+9+3=43

so the output should be 43


Family List:

A list of words is called the Family if the words in the list follow the following rule.

we should be able to obtain each word in the list by

-changing exactly one letter from the previous word in the list

-or , by adding exactly one letter to the previous word in the list

-or ,by removing exactly one letter from the previous word in the list

Given a list of words ,determine if the list is a Family or Not a Family

input:

The first line of input is an integer T representing the number of test cases

the first line of each test case has an integer N representing the total number of words

The second line contains N space separated strings

INPUT:

3

3

hip hop top

3

hip top hop

4

teat treat greet meet

output:

family

not a family

not a family

i/p:

3

3

tic tac toe

2

tic tac

3

tet treat greet

o/p:

not a family

family

not a family

Note:please display the output


Answer to Question #341372 in Python



Note:Error is displaying in this code, please correct it

Enter the number of societies:Keep the number of people in societies:

Traceback (most recent call last):

 File "main.py", line 4, in <module>

  num_people = int(input('Keep the number of people in societies:'))

ValueError: invalid literal for int() with base 10: '\r'


Create an application that calculates your daily driving cost, so that you can estimate how much money could be saved by carpooling, which also has other advantages such as reducing carbon emissions and reducing traffic congestion. The application should input the following information and display the user’s cost per day of driving to work: 

a) Total miles driven per day. 

b) Cost per gallon of gasoline. 

c) Average miles per gallon.

d) Parking fees per day. 

e) Tolls per day.


A window with the title “Welcome Home”

What is the output of the following code?


int x = 100;


int y = 200;



if (x > 100 && y <= 200)


System.out.println(x + “ “ + y + “ “ + (x + y));


else


System.out.println(x + “ “ + y + “ “ + (2 * x - y));

Declare the Person superclass as abstract. Add this abstract method to the class:

public abstract void eat(String food);

Both the Student and Employee class inherit from abstract superclass Person, and provides an implementation for eat() which displays that the student or employee is eating a certain food.

(Note what happens if you don’t implement eat().)



Create an interface called StudentInterface. This interface has the following abstract method:

public void study(String subject);

The Student class implements this interface, and provides an implementation for study() which displays that the student is studying a certain subject.

(Note what happens if you don’t implement study().)


Write a program in Python programming language, which allows the user to input an integer value. Based on the input values, the program should perform the following tasks:


⦁ If the entered value is negative then it should print “Factorial does not exist for negative numbers”.

⦁ If the entered value is 0 then it should print “The factorial of 0 is 1”.

⦁ Calculate and display the factorial of the given integer.



Write a program in Python programming language, which allows the user to input a number and upper limit, and based on the input values, the program should perform the following tasks:

⦁ Check whether the value entered by the user is a positive integer.

⦁ Generates an error massage in case of negative integer.

⦁ Generate a table of given number.

⦁ Upper limit for table will be get from user.



LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS