0% found this document useful (0 votes)
36 views

Assignment No 1

This document outlines 8 programming assignments involving writing Python functions to: 1. Calculate the area and volume of cylinders 2. Calculate the area and volume of rectangles 3. Calculate the nth term of an arithmetic sequence 4. Check if a string is a palindrome 5. Sort an array in ascending order 6. Calculate physics equations for motion 7. Reverse a name 8. Generate a table of trigonometric functions

Uploaded by

ayaan khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views

Assignment No 1

This document outlines 8 programming assignments involving writing Python functions to: 1. Calculate the area and volume of cylinders 2. Calculate the area and volume of rectangles 3. Calculate the nth term of an arithmetic sequence 4. Check if a string is a palindrome 5. Sort an array in ascending order 6. Calculate physics equations for motion 7. Reverse a name 8. Generate a table of trigonometric functions

Uploaded by

ayaan khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Assignment No:1

Programming Fundamentals (Python)

Q1. Write two functions which will take required arguments for calculating the Area and Volume of
cylinder.

INPUT:

OUTPUT:
Q2. Write two functions which will take required arguments for calculating the Area
and Volume of rectangle. Figure 2 is giving for your help.

INPUT:

OUTPUT:
Q3. Write a function that can calculate the arithmetic sequence of n numbers. The program will
generate the nth term of the sequence, whereas the user will enter the first term and the common difference.
The program will then ask either to continue or not, if the user will enter yes it will ask the next nth term to
calculate. Example: you have entered the first term as 3 and common difference 6 you are interesting
in 35th term. So it will calculate and generate the answer as 207. Calculate
𝑎𝑛 = 𝑎1 + (𝑛 − 1)𝑑

INPUT:

OUTPUT:
4. Write a function which will check either the giving string is Palindrome or not. Palindrome is
a string when we reverse the string it will generate the original string. Example CIVIC, MOM,
010,1001, etc. So if you enter the word which is Palindrome it will say yes your string is
Palindrome otherwise it will generate sorry message.

INPUT:

OUTPUT:
5. Create a Python application that includes an array holding elements
37, 2, 6,4,90,45,67,21
And sort all the array elements in ascending order.

INPUT:

OUTPUT:
6. Write multiple functions that can calculate three laws of motions in
physics

INPUT:

OUTPUT:
7. Write a function which will generate your name in reverse order.

INPUT:

OUTPUT:
8. Write a function which will generate a table of sin(), cos(), tan() with user define range.

INPUT:

OUTPUT:

You might also like