This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Armstrong Number using Python (Github:-PushkraJ99) | |
i=int(input("Enter Number to Check : ")) | |
orig=i | |
sum=0 | |
while(i>0): | |
sum=sum+(i%10)*(i%10)*(i%10) | |
i=i//10 | |
if orig==sum: | |
print("This Number is Armstrong !!") | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1D Array using Python (Github:-PushkraJ99) | |
import numpy | |
n= int(input("Enter Size :")) | |
arr = numpy.ndarray(shape=(n)) | |
print("Enter %d Elements :" %n) | |
for i in range (n): | |
arr[i] = int(input()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Bubble Sort using Python (Github:-PushkraJ99) | |
def sort (num): | |
for i in range (len(num)-1,0,-1): | |
for j in range (i): | |
if num [j]>num[j+1]: | |
temp =num[j] | |
num[j]=num[j+1] | |
num[j+1]=temp | |
num=[1,5,8,9,4,7,6] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Fibonacci Sequence using Python (Github:-PushkraJ99) | |
def fib(n): | |
if (n<=1): | |
return n | |
else: | |
return (fib(n-1)+fib(n-2)) | |
num=int(input("Enter number:")) | |
for u in range(num): | |
print(fib(u)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Program to check if a string is palindrome or not | |
string = input("Input the String:") | |
# make it suitable for caseless comparison | |
string = string.casefold() | |
# reverse the string | |
rev_str = reversed(string) | |
# check if the string is equal to its reverse |
NewerOlder