Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Calculator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'''
As a user, I want to use a program which can calculate basic mathematical operations.
So that I can add, subtract, multiply or divide my inputs.
Acceptance Criteria:
The calculator must support the Addition, Subtraction, Multiplication and Division operations.
Define four functions in four files for each of them, with two float numbers as parameters.
To calculate the answer, use math.ceil() and get the next integer value greater than the result
Create a menu using the print command with the respective options and take an input choice from the user.
Using if/elif statements for cases and call the appropriate functions.
Use try/except blocks to verify input entries and warn the user for incorrect inputs.
Ask user if calculate numbers again. To implement this, take the input from user Y or N.
Author=Bulent Caliskan date=01/02/2021
'''
#We import the modules that need to be imported.
from math import ceil
#creat calculator function with ceil modul
# we also use try/except method for avoid mistakes
def calculator():
while True:
try:
numbers=input("Enter the numbers you want to calculate(+/*-).Exmp= 4 + 5=> \n")
numberSplit=numbers.split(" ")
x,y,oparation=float(numberSplit[0]),float(numberSplit[2]),numberSplit[1]
if oparation=="+":
print(f"= {ceil(x+y)}")
elif oparation=="-":
print(f"= {ceil(x-y)}")
elif oparation=="/":
print(f"= {ceil(x/y)}")
elif oparation=="*":
print(f"= {ceil(x*y)}")
else:
print("You entered a wrong transaction.please dont forget space!")
continue
except:
print("You entered a wrong transaction")
continue
yn = input("Do you want to continue. Y/N ")
if yn == "Y" or yn == "y":
continue
else:break
# call the function
calculator()
44 changes: 44 additions & 0 deletions Lcm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
''''
****The Least Common Multiple****
As a user, I want to use a program which can calculate the least common multiple (L.C.M.) of four numbers.
So that I can find the least common multiple (L.C.M.) of my inputs.
Acceptance Criteria:
Ask user to enter the four numbers.
Use blocks to verify input entries and warn the user for Nan or non numerical inputs.try/except
Calculate the least common multiple (L.C.M.) of four numbers
Use gcd function in module of math
Author= Bulent Caliskan date=31/01/2021
'''
import math as m
# put the 4 numbers we get from the user into a list.
def numberList():
x=1
number_list=[]
while x<5:
try:
numbers=int(input(f"Enter {x}. number which you want to calculate "
"\nthe least common multiple?"))
number_list.append(numbers)
x+=1
except:
print("You did not enter a number ")
continue
return number_list
numbersList=numberList()
#creat GCM for 4 numbers
def gcm():
number_gcm=numbersList
glm1=m.gcd(number_gcm[0] , number_gcm[1])
glm2=m.gcd(glm1 , number_gcm[2])
glmFourNumbers=m.gcd(glm2 , number_gcm[3])
return glmFourNumbers
# creat LCM for 4 numbers and use math.gcd() modul
def lcm():
number_lcm=numbersList
lcm1=int((number_lcm[0]*number_lcm[1])/(m.gcd(number_lcm[0],number_lcm[1])))
lcm2=int(lcm1*number_lcm[2]/(m.gcd(lcm1,number_lcm[2])))
lcmFourNumbers= int(lcm2*number_lcm[3]/(m.gcd(lcm2,number_lcm[3])))
return lcmFourNumbers
print(f"LCM of your 4 numbers {lcm()}") # call the LCM function

print(f"GCM of your 4 numbers {gcm()}")# call the GCM function
39 changes: 39 additions & 0 deletions NumberGuessingGame.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
''''
As a player, I want to play a game which I can guess a number the computer chooses in the range I chose.
So that I can try to find the correct number which was selected by computer.
Acceptance Criteria:
Computer must randomly pick an integer from user selected a range, i.e., from A to B, where A and B belong to Integer.
Your program should prompt the user for guesses
if the user guesses incorrectly, it should print whether the guess is too high or too low.
If the user guesses correctly, the program should print total time and total number of guesses.
You must import some required modules or packages
You can assume that the user will enter valid input.
4- Mis Calculator
Author=Bulent Caliskan date 01/02/2021
'''
#We import the modules that need to be imported.
import random
from timeit import default_timer as timer
#start the game time
start = timer()
#creat guessFunc function with random modul
def guessFunc():
print("Enter two numbers and try to guess the number to choose between. ")
a,b=int(input("Enter first number")),int(input("Enter second number"))
number=random.randint(a,b)
move = 0
while True:
move+=1
guess=int(input("Guess the number I kept "))
if number < guess:
print("You should enter a smaller number than your guess. ")
continue
elif number> guess:
print("You should enter a bigger number than your guess. ")
continue
else:
#finish the game time and return result with f string
end = timer()
return print(f"Congratulations, you got the correct guess in {end-start:.3} second and {move} times. ")
#call the function
guessFunc()
65 changes: 65 additions & 0 deletions RandomPassword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
''''
As a user, I want to use a program which can generate random password and display the result on user interface.
So that I can generate my password for any application.

Acceptance Criteria:

Password length must be 10 characters long.
It must contain at least 2 upper case letter, 2 digits and 2 special symbols.
You must import some required modules or packages.
The GUI of program must contain at least a button and a label.
The result should be display on the password label when the user click the generate button.
Author= Bulent Caliskan date= 31/01/2021
'''
import tkinter as tk

import random

# Function for calculation of password
def passFunc():
entry.delete(0, 'end')

length=10
lower = "abcdefghijklmnopqrstuvwxyz"
upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
digits = "0123456789!@#$%^&*()"
password = ""
for i in range(0,3):
password=password+random.choice(lower)
for i in range(0,3):
password = password + random.choice(upper)
for i in range(0,4):
password = password + random.choice(digits)
ps=set(password)
return "".join(ps)
# Function for generation of password
def button():
password1=passFunc()
entry.insert(10,password1)

# main function
randompass=tk.Tk()
# Title of your GUI window
randompass.title("Random Password 1.1")
randompass.geometry("400x200")

# create label and entry to show
# password generated
rpLabel=tk.Label(randompass,text=" Press the button to generate a random password ",bg="white")
rpLabel.pack(pady=20)

passView = tk.Label(randompass, text=" Password ",fg="green",font=("Open Sans","10","bold"))
passView.pack(pady=1)

entry = tk.Entry(randompass,text= passFunc)
entry.pack(pady=10)

# create Button
button =tk.Button(randompass, text = " GENARATE ",width=15,height =2,fg="green",command=button)
button.pack(pady=5)

# start the GUI
randompass.mainloop()