0% found this document useful (0 votes)
18 views3 pages

Assignment - (PCC DS 391) - Day-2 - GR-X

Uploaded by

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

Assignment - (PCC DS 391) - Day-2 - GR-X

Uploaded by

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

Laboratory Assignment: Day : 02

Department Computer Science & Engineering (Data Science)


Course Code PCC DS 391 Course Title Data Science Lab using Python
Semester 3rd, B. Tech Topic: Python if else, for loop
Slot/ Section SEC-X Faculty Name & ID Dr. Sovan Bhattacharya,
BCR/ENGG/T/323
Academic Year 2024-25
Assignment Issue Date 29/07/2024 Assignment 05/08/2024
Submission Date

Python if else, for loop


1. Print First 10 natural numbers using while loop

2. Write a program to accept a number from a user and calculate the sum of all numbers from 1 to a
given number

For example, if the user entered 10 the output should be 55 (1+2+3+4+5+6+7+8+9+10)

3. Write a program to print multiplication table of a given number


For example, num = 2 so the output should be
4. Write a program to display all prime numbers within a range
Note: A Prime Number is a number that cannot be made by multiplying other whole numbers. A
prime number is a natural number greater than 1 that is not a product of two smaller natural
numbers
Examples:
6 is not a prime number because it can be made by 2×3 = 6
37 is a prime number because no other whole numbers multiply together to make it.

5. Display Fibonacci series up to 10 terms


The Fibonacci Sequence is a series of numbers. The next number is found by adding up the two
numbers before it. The first two numbers are 0 and 1.

For example, 0, 1, 1, 2, 3, 5, 8, 13, 21. The next number in this series above is 13+21 = 34.

6. Find the factorial of a given number


Write a program to use the loop to find the factorial of a given number.
The factorial (symbol: !) means to multiply all whole numbers from the chosen number down to 1.

For example: calculate the factorial of 5


7. Reverse a given integer number
Given:

76542

Expected output:

24567
8. Calculate the cube of all numbers from 1 to a given number, Write a program to print the cube of all
numbers from 1 to a given number
Given:
input_number = 6

9. Find the sum of the series upto n terms, Write a program to calculate the sum of series up to n term.
For example, if n =5 the series will become 2 + 22 + 222 + 2222 + 22222 = 24690
10. Print First 10 natural numbers using while loop

You might also like