-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#main program | ||
n=int(input('enter the number N')) | ||
n1=1 | ||
n2=2 | ||
n3=n1+n2 | ||
sum=0 | ||
while (n3<n): | ||
n1=n2 | ||
n2=n3 | ||
n3=n1+n2 | ||
print(n3) | ||
if (n3%2 == 0): | ||
sum = sum + n3 | ||
|
||
print(sum) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
n,k=map(int,input().split()) | ||
print(n*k//2) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
b=0 | ||
a=0 | ||
for i in range(1,26): | ||
x = int(input("enter")) | ||
if x>0: | ||
a=abs(6-i) | ||
if(b>a): | ||
b=a | ||
print(b) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
xpoints = np.array([0, 6]) | ||
ypoints = np.array([0, 250]) | ||
|
||
plt.plot(xpoints, ypoints) | ||
plt.show() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
class Node: | ||
|
||
# Constructor to initialize the node object | ||
def __init__(self, data): | ||
self.data = data | ||
self.next = None | ||
|
||
|
||
class LinkedList: | ||
|
||
# Function to initialize head | ||
def __init__(self): | ||
self.head = None | ||
|
||
# Function to reverse the linked list | ||
def reverse(self): | ||
prev = None | ||
current = self.head | ||
while(current is not None): | ||
next = current.next | ||
current.next = prev | ||
prev = current | ||
current = next | ||
self.head = prev | ||
|
||
# Function to insert a new node at the beginning | ||
def push(self, new_data): | ||
new_node = Node(new_data) | ||
new_node.next = self.head | ||
self.head = new_node | ||
|
||
# Utility function to print the linked LinkedList | ||
def printList(self): | ||
temp = self.head | ||
while(temp): | ||
print (temp.data) | ||
temp = temp.next | ||
|
||
|
||
# Driver code | ||
llist = LinkedList() | ||
llist.push(20) | ||
llist.push(4) | ||
llist.push(15) | ||
llist.push(85) | ||
llist.printList() | ||
llist.reverse() | ||
llist.printList() | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
money_transaction= int(input("Enter the amount to be transcated")) | ||
bank_balance= int(input("Enter the bank balance")) | ||
if (money_transaction % 5==0): | ||
if (bank_balance > money_transaction): | ||
bank_balance= bank_balance- money_transaction - 0.5 | ||
print("the money transcated is",money_transaction) | ||
print("the current balance is",bank_balance) | ||
else: | ||
print("insufficient balance") | ||
else: | ||
print("Incorrect money transcation") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
n=int(input()) | ||
while n>0: | ||
n=n-1 | ||
count=0 | ||
l=int(input()) | ||
list1 = [] | ||
list1= list(map(int,input().split())) | ||
for i in range(0,l): | ||
for j in range(i,l): | ||
if (list1[i]*list1[j] >= 0): | ||
count = count+1 | ||
print(count) |