Skip to content

Commit

Permalink
codes for graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
sadock123 committed Oct 13, 2022
1 parent 7295f87 commit ca96680
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Fibonacci umbers.py
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)
2 changes: 2 additions & 0 deletions domino.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
n,k=map(int,input().split())
print(n*k//2)
9 changes: 9 additions & 0 deletions first.py
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)
8 changes: 8 additions & 0 deletions graph.py
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()
50 changes: 50 additions & 0 deletions linkedlist.py
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()


11 changes: 11 additions & 0 deletions money_transaction.py
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")
12 changes: 12 additions & 0 deletions positivenumber.py
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)

0 comments on commit ca96680

Please sign in to comment.