Skip to content

Commit

Permalink
Merge pull request #42 from prabhus489/dev
Browse files Browse the repository at this point in the history
Dev to master Release
  • Loading branch information
prabhus489 authored May 7, 2022
2 parents b09bff0 + e16bb5d commit 7da1a45
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 12 deletions.
17 changes: 8 additions & 9 deletions Addition.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# To add all numbers in a collection
def AddCollection(inputValues):
sum = 0
for num in inputValues:
sum +=num
return sum
#Python program to add two numbers using function

# To add two numbers
def AddTwoNumbers(num1, num2):
return num1 + num2
def add_num(a,b):#function for addition
sum=a+b;
return sum; #return value
num1=int(input("input the number one: "))#input from user for num1
num2=int(input("input the number one :"))#input from user for num2

print("The sum is",add_num(num1,num2))#call te function
4 changes: 3 additions & 1 deletion PercentageInteger.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ def GetPercentFloat(first, second, integer = True):
num2 = float(input("Enter Second number: "))

GetPercentFloat(num1, num2)
print(GetPercentFloat(num1, num2))
print(GetPercentFloat(num1, num2))

#This is a comment by Raj
2 changes: 2 additions & 0 deletions SimpleCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ def divide(x, y):

else:
print("Invalid Input")

# This is a comment being added
9 changes: 9 additions & 0 deletions Subtraction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#python program to subtract two numbers using function

def subtraction(x,y): #function definifion for subtraction
sub=x-y
return sub
num1=int(input("please enter first number: "))#input from user to num1
num2=int(input("please enter second number: "))#input from user to num2

print("Subtraction is: ",subtraction(num1,num2))#call the function
15 changes: 14 additions & 1 deletion calculator.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import sys

from PyQt5.QtWidgets import QApplication, QVBoxLayout, QGridLayout, QPushButton, QLabel, QTextEdit
from PyQt5.QtWidgets import QWidget
from PyQt5.QtCore import Qt
import SimpleCalculator as calc_func


class Calculator(QWidget):
"""
Class for initializing the UI and calculator functionalities
"""

def __init__(self):
super().__init__()
Expand All @@ -19,6 +21,9 @@ def __init__(self):
self.op_pressed = False

def create_ui(self):
"""
Class for creating the calculator UI
"""
self.setWindowTitle('Calculator')
vBoxLayout = QVBoxLayout()
gridLayout = QGridLayout()
Expand Down Expand Up @@ -52,6 +57,9 @@ def create_ui(self):
self.show()

def button_clicked(self):
"""
Method for creating the connection between UI element and the functionality
"""
# TODO: Implement Calculator logic
sender = self.sender()
button_txt = sender.text()
Expand Down Expand Up @@ -80,6 +88,9 @@ def button_clicked(self):
self.result_display.setAlignment(Qt.AlignRight)

def perform_op():
"""
Method for performing the arithmetic operations
"""
if self.current_op == 'add':
result = calc_func.add(self.x, self.y)
elif self.current_op == 'subtract':
Expand All @@ -100,3 +111,5 @@ def perform_op():
app = QApplication(sys.argv)
calc = Calculator()
sys.exit(app.exec_())

# This is a comment by Raj
8 changes: 8 additions & 0 deletions division.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def divNum(a,b):#function definision
return a/b
num1=int(input("Please input the number for num1: "));
#Ask and reading the input from user for num1
num2=int(input("Please input the number for num2: "));
#Ask and reading the input from user for num2
print("Division of given numbers is:",divNum(num1,num2))
#call the function
13 changes: 13 additions & 0 deletions exponent.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Python Program to find Power of a Number

number = int(input(" Please Enter any Positive Integer : "))
exponent = int(input(" Please Enter Exponent Value : "))

power = 1
i = 1

while(i <= exponent):
power = power * number
i = i + 1

print("The Result of {0} Power {1} = {2}".format(number, exponent, power))
6 changes: 5 additions & 1 deletion multiply.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ def MultiplyCollection(inputValues):

# To multiply two numbers
def MultiplyTwoNumbers(num1, num2):
return num1 * num2
return num1 * num2

# To multiply two numbers
def MultiplyNumbers(a, b):
return a * b
2 changes: 2 additions & 0 deletions test_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ def test_divide(self):
ct.test_subtract()
ct.test_multiply()
ct.test_divide()

# This is a comment added by Raj

0 comments on commit 7da1a45

Please sign in to comment.