Skip to content

Commit

Permalink
final project
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerollos Magdy committed May 5, 2018
1 parent 62720ac commit cd3f702
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 0 additions & 2 deletions change_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def gate_x(t_password):
def change_password(ls):
# Get the old password
old_password = ls[2]
'''curry the old password'''

# Ask to old password to enter new one
flag = gate_x(old_password)
Expand All @@ -53,5 +52,4 @@ def change_password(ls):

# Write the new password
elif flag == '1':
'''Wrong massage'''
input("Out of range of try ... press Enter")
29 changes: 24 additions & 5 deletions show_history.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
import read_file
import os

"""show_history function: shows the processes made to a certain account"""


def print_process(process):
date = '{}'.format(process[2:7])
print('{0}\t{1}\t{2}{3: ^10} {4: ^10}'.format(
process[0],
process[1].center(len('change_password')),
date.center(len(date)),
process[7],
process[8]
)
)


def show_history(ls):
# ls is the list contains account data
# ls[0] id
Expand All @@ -22,24 +35,30 @@ def show_history(ls):
# id_list[line][2:6] process_date
# id_list[line][7] before_process
# id_list[line][8] after_process

os.system('clear')
top_line = '\nID\t' + 'Type'.center(len('change_password')) + 'Date and Time'.center(40) + 'before'.center(10) + 'after'.center(15)
print(top_line)
print('-' * len(top_line))
if choice == 1:
for line in id_list:
if line[1] == 'deposit':
print(line)
print_process(line)
elif choice == 2:
for line in id_list:
if line[1] == 'withdraw':
print(line)
print_process(line)
elif choice == 3:
for line in id_list:
if line[1] == 'change_password':
print(line)
print_process(line)
elif choice == 4:
for line in id_list:
print(line)
print_process(line)
elif choice == 5:
new_file = open(file_name, 'w')
new_file.close()
else:
print('ERROR: Wrong choice')

input('\nPress Enter to go back..')
os.system('clear')

0 comments on commit cd3f702

Please sign in to comment.