diff --git a/FundTracker Sysytem/fundtracker.py b/FundTracker Sysytem/fundtracker.py new file mode 100644 index 0000000..3d248ed --- /dev/null +++ b/FundTracker Sysytem/fundtracker.py @@ -0,0 +1,76 @@ +import sys + +def main(): + fund_donor = [] + recipient = [] + while True: + print("\n\n1. Enter fund donor's data\n2. Enter fund recipient's data\n3. Retrieve Donor specific data\n4. Retrieve Recipient specific data\n5. Exit system\n\n") + ch = int(input("Enter your choice : ")) + if ch==1: + print("\nEnter the following details:") + name = input("Fund donor's name : ") + ind = -1 + for i in range(len(fund_donor)): + if name.lower()==fund_donor[i][0]: + ind = i + if ind > -1: + fund_donor[ind][2] += 1 + else: + amtdon = input("Amount donated : ") + waydon = input("Enter the method of donation : ") + fund_donor.append([name,amtdon,1,waydon]) + print("\nThank you! Fund donor's details successfully updated!") + elif ch==2: + print("Enter the following details:") + name = input("Fund recipient name : ") + ind = -1 + for i in range(len(recipient)): + if name.lower()==recipient[i][0]: + ind = i + amtrec = input("Amount received : ") + wayrec = input("Enter the method of fund transfer : ") + recipient.append([name,amtrec,wayrec]) + print("\nThank you! Recipient details successfully updated!") + elif ch==3: + while True: + print("\n1. Show data of all fund donors\n2. Show data of specific method of fund transfer\n") + opt = int(input("Enter choice : ")) + if opt==1: + print("\n\nNAME\tAMT DONATED\tMETHOD\n") + for i in range(len(fund_donor)): + print(fund_donor[i][0]+"\t"+fund_donor[i][1]+"\t"+str(fund_donor[i][2])) + break + elif opt==2: + hosp = input("Enter fund transfer method : ") + print("\n\nNAME\tAMT DONATED\tMETHOD\n") + for i in range(len(fund_donor)): + if fund_donor[i][2]== waydon.lower(): + print(fund_donor[i][0]+"\t"+fund_donor[i][1]+"\t"+str(fund_donor[i][2])) + break + else: + print("Wrong choice!! Try again!") + elif ch==4: + while True: + print("1. Show dataof all Recipients\n2. Show data of specifc fund transfer\n") + opt = int(input("Enter choice : ")) + if opt==1: + print("\n\nNAME\tAMT RECEIVED\tMETHOD OF FUND TRANSFER\n") + for i in range(len(recipient)): + print(recipient[i][0]+"\t"+recipient[i][1]+"\t"+str(recipient[i][2])) + break + elif opt==2: + hosp = input("Enter method name : ") + print("\n\nNAME\tAMT RECIEVED\tMETHOD\n") + for i in range(len(fund_donor)): + if recipient[i][3].lower()==wayrec.lower(): + print(recipient[i][0]+"\t"+recipient[i][1]+"\t"+str(recipient[i][2])) + break + else: + print("Wrong choice!! Try again!") + elif ch==5: + print("\n\nThank you for using our system!!\nHave a good day!\n") + sys.exit(1) + else: + print("Wrong Choice!! Try again!") + +main() \ No newline at end of file diff --git a/README.md b/README.md index 4ec5e69..2247e9c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # pythonbeginner This repository contains programs implemented in python. Questions have been solved by HackerRank Practice- -- Contains solutions from -##### HackerRank 30 days of code and Python. +- Contains solutions from HackerRank 30 days of code and Python. + +#### Added Fundtracker system as a part of Hacktober Fest 2020. diff --git a/day28-RegX.py b/day28-RegX.py new file mode 100644 index 0000000..b947add --- /dev/null +++ b/day28-RegX.py @@ -0,0 +1,23 @@ +#!/bin/python3 + +import math +import os +import random +import re +import sys + + + +if __name__ == '__main__': + N = int(input()) + lst = [] + + for N_itr in range(N): + firstNameEmailID = input().split() + + firstName = firstNameEmailID[0] + + emailID = firstNameEmailID[1] + if re.search('@gmail\.com$',emailID): + lst.append(firstName) + print(*sorted(lst),sep='\n') diff --git a/largest_element_in_the_list b/largest_element_in_the_list new file mode 100644 index 0000000..fa04e9a --- /dev/null +++ b/largest_element_in_the_list @@ -0,0 +1,16 @@ +# Python Program to find Largest Number in a List and also the index position of that largest element + +NumList = [] +Number = int(input("Please enter the Total Number of List Elements: ")) +for i in range(1, Number + 1): + value = int(input("Please enter the Value of %d Element : " %i)) + NumList.append(value) + +largest = NumList[0] +for j in range(1, Number): + if(largest < NumList[j]): + largest = NumList[j] + position = j + +print("The Largest Element in this List is : ", largest) +print("The Index position of the Largest Element is : ", position) diff --git a/nth fibonaccinumber.py b/nth fibonaccinumber.py new file mode 100644 index 0000000..1a20ca9 --- /dev/null +++ b/nth fibonaccinumber.py @@ -0,0 +1,17 @@ +# Function for nth Fibonacci number + +def Fibonacci(n): + if n<=0: + print("Incorrect input") + # First Fibonacci number is 0 + elif n==1: + return 0 + # Second Fibonacci number is 1 + elif n==2: + return 1 + else: + return Fibonacci(n-1)+Fibonacci(n-2) + +# Driver Program + +print(Fibonacci(9)) \ No newline at end of file diff --git a/practice/python/python/leap_year.py b/practice/python/python/leap_year.py new file mode 100644 index 0000000..9129592 --- /dev/null +++ b/practice/python/python/leap_year.py @@ -0,0 +1,13 @@ +def is_leap(year): + if year % 4 == 0: + leap = True + if year % 400 == 0: + leap = True + elif year % 100 == 0: + leap = False + else: + leap = False + return leap + + +print(is_leap(int(input("Enter a year to check for Leap year: ")))) diff --git a/practice/python/python/prime_number.py b/practice/python/python/prime_number.py new file mode 100644 index 0000000..9590686 --- /dev/null +++ b/practice/python/python/prime_number.py @@ -0,0 +1,9 @@ +def is_prime(num): + for i in range(2, int(num/2)): + if num % i == 0: + return False + return True + + +number = 13 +print(is_prime(number))