[go: up one dir, main page]

0% found this document useful (0 votes)
28 views10 pages

Deep Learning Lab File - R1UC604C

Uploaded by

kdbfr
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)
28 views10 pages

Deep Learning Lab File - R1UC604C

Uploaded by

kdbfr
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/ 10

Deep learning lab file

Course code: R1UC604C


Riya Tyagi
Admission Number: 21SCSE1010086

SCHOOL OF COMPUTER
SCIENCE AND ENGINEERING
GALGOTIAS UNIVERSITY,
GREATER NOIDA
UTTAR PRADESH
PROBLEM NO.: 01

AIM: Python Program to Print the Fibonacci sequence

PROGRAM:

nterms = int(input("How many


terms? ")) n1, n2 = 0, 1 count =
0 if nterms <= 0: print("Please
enter a positive integer")
elif nterms == 1: print("Fibonacci
sequence upto",nterms,":")
print(n1)
else:
print("Fibonacci
sequence:") while
count < nterms:
print(n1) nth = n1 +
n2 n1 = n2 n2 = nth
count += 1

OUTPUT:
PROBLEM NO.: 02

AIM: Python Program to check a given number is


Palindrome or not.

PROGRAM:
n=int(input("Enter number : "))
temp=
n
rev=0
while(
n>0):
dig=n%10
rev=rev*10+dig n=n//10
if(temp==rev): print("Given
number is palindrome")
else:
print("Given number is not palindrome")

OUTPUT:
PROBLEM NO.: 03

AIM: Python Program to find factorial of a given number.

PROGRAM:

num=int(input("Enter the number: "))


factorial=1 if num < 0: print("Sorry, factorial does
not exist for negative numbers")
elif num == 0:
print("The factorial of 0 is 1")
else:
for i in range(1,num + 1):
factorial = factorial*i
print("The factorial of",num,"is",factorial)

OUTPUT:
PROBLEM NO.: 04

AIM : Python Program to check given number is


Armstrong number or not.

PROGRAM:

num = int(input("Enter a number: "))


sum = 0
temp = num
while temp > 0:
digit = temp % 10
sum += digit ** 3
temp //= 10
if num == sum:
print(num,"is an Armstrong number")
else:
print(num,"is not an Armstrong number")

OUTPUT:

You might also like