вторник, 16 августа 2016 г.

Расходы на покупки , стартовый шаблон. // The cost of purchase , the starting template.

Всем привет после долго перерыва я решил попробовать еще раз искусство программирования, на этот раз я пытаюсь создать программу для записи ваших затрат на покупки чего либо. Это набросок будущей программы,я планирую сделать суммирование затрат, вычитание затрат из бюджета с последующим выводом и сохранением в файл.  и разбитие введенных затрат по дате и времени( внесение в базу). В будущем я планирую переписать код и приделать базу sql . 
//
Hi all after a long break I decided to try again the art of computer programming, this time I'm trying to create a program to record your expenses on the purchase of something. This is a sketch of the future program,I plan to do a summation of costs, subtract the cost of the budget with the subsequent withdrawal and saving it to file. and the breaking of imposed costs on the date and time( making the base). In the future I plan to rewrite the code and attach the sql database .


# -*- coding: utf-8 -*-

import sys

file ="date.txt"

textsum = str(input("enter the first number"))

summoney = float(input ("Enter the second number: "))

def insum (textsum, summoney):

    datafile = open (file,'a')

    if textsum == str(textsum) and summoney == float(summoney):

        datafile.write('{0} = {1} \n' .format(textsum, summoney))

    else:

        print('error')

    datafile.close()


def printfile():

    with open(file, 'r') as f:

        print(f.read())


insum (textsum, summoney)

printfile()

Комментариев нет:

Отправить комментарий