Question
Write python program using function to find the sum of first n terms of the following series:

where n and x have to be input from the user. The function should have two parameter n and x and return the sum of the series.

Answer

Get the step-by-step solution for this question inside the Vidyadip app.

Get the answer in the app

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free

Similar questions

Write a function update () to update the record in the binary file “student”, which consist of student number, student name and marks. The updation should be done on the basis of student number entered by the user.
Write a python program using function to print the sum of first n natural numbers. 
Write a Python Function to count the number of elements in a list within a specified range.

Write a script to create a list of 10 random floating point numbers and then
(a) Find the mean of the elements present in the list (without using sum() function)
(b) Find the mean of all those elements of the list which are more than the mean calculated in 5c (above part of the question)
Write a function addrecord() a add new record to the binary file “student” using list. The list should consist of student number, student name and marks of the student.

Consider the following tables CARHUB and CUSTOMER and answer (a) and (b) parts of this question:

Table: CARHUB

Vcode VehicleName Make Color Capacity Charges
100 Innova Toyota WHITE 7 15
102 SX4 Suzuki BLUE 4 14
104 C Class Mercedes RED 4 35
105 A-Star Suzuki WHITE 3 14
108 Indigo Tata SILVER 3 12

Table: CUSTOMER

CCode CName VCode
1 Hemant Sahu 101
2 Raj Lal 108
3 Feroza Shah 105
4 Ketan Dhal 104

(a) Write SQL commands for the following statements:

(i) To display the names of all white colored vehicles

(ii) To display name of vehicle, make and capacity of vehicles in ascending order of their sitting capacity

(iii) To display the highest charges at which a vehicle can be hired from CARHUB.

(iv) To display the customer name and the corresponding name of the vehicle hired by them.

(b) Give the output of the following SQL queries:

(i) Select count(distinct make) from cabhub;

(ii) Select max(charges), min(charges) from carhub;

(iii) Select count(*), make from carhub;

(Iv) Select vehiclename from carhub where capacity = 4;

How to Rename the Index or Columns of a Pandas DataFrame?

Write a script to create a list of 10 random integers and display it. Then input an integer from the user and check whether it is present in the list (use in operator) and display an appropriate message.

How can one protect from cyber fraud?
Write python program using function to find the sum of first n terms of the following series: x - x2 + x3 - . . . where n and x have to be input from the user. The function should have two parameter n and x and return the sum of the series.