def main():
    run = 1
    db_helper.create_table()

    while run:
        print("\n")
        print('1. INSERT A TASK \n'
              '2. View tasks \n'
              '3. Delete tasks \n'
              '4. EXIT \n')
        x = input(" Enter your choice: ")

        if x == "1":
            task = str(input("Enter your task: "))
            db_helper.data_entry(task)

        elif x == "2":
            db_helper.print_data()

        elif x == "3":
            IndexToDelete = int(print('enter the Task index to delete:'))
            db_helper.delete_task(IndexToDelete)

        elif x == "4":
            run = 0

        else:
            print('choose a valid option')

    db_helper.close_cursor()
Ejemplo n.º 2
0
def main():
    r = 1
    db_helper.create_table()
    while(r):
        print("1. Insert New Task")
        print("2. View a Task")
        print("3. Delete a Task")
        print("4. Exit")
        x = input("Choose any option: ")
        print()

        if x == "1":
            task = str(input("Enter the Task: "))
            db_helper.data_entry(task)
        elif x == "2":
            db_helper.printData()
        elif x == "3":
            index = int(input("Enter the task index: "))
            db_helper.deleteTask(index)
        elif x == "4":
            r = 0
        else:
            print("Enter values between 1 to 4 ")

    db_helper.closeCursor()
Ejemplo n.º 3
0
def main():
    run = 1
    db_helper.create_table()

    while run:
        print("\n")
        print('1. Insert new task in todo list \n'
              '2. View the todo list \n'
              '3. Delete the task \n'
              '4. exit \n')
        x = input("Choose any of above option: ")

        if x == "1":
            task = str(input("Enter your todo: "))
            db_helper.data_entry(task)

        elif x == "2":
            db_helper.printData()
        elif x == "3":
            indexToDelete = int(
                input("Enter the index of the task to be deleted: "))
            db_helper.deleteTask(indexToDelete)
        elif x == "4":
            run = 0
        else:
            print("Please choose valid option")

    db_helper.closeCursor()
Ejemplo n.º 4
0
def main():
    run = 1
    db_helper.create_table()

    while run:
        print()
        print("1: Insert new task\n2:View Todo List\n3:Delete Todo\n0:Exit")
        x = int(input("Enter choice: "))
        if x == 1:
            task = input("Enter task: ")
            db_helper.data_entry(task)

        elif x == 2:
            db_helper.printData()

        elif x == 3:
            index = int(input("Enter Todo Index to delete: "))
            db_helper.deleteTask(index)

        elif x == 0:
            run = 0

        else:
            print("Wrong choice...")

    db_helper.closeCursor()
Ejemplo n.º 5
0
def main():
    run = 1
    db_helper.create_table()
    while run:
        print()
        print("1. Insert a new task in the todo list \n"
              "2. View the todo list\n"
              "3. Delete the task\n"
              "4. Exit\n")
        x= int(input("Choose any of the above option "))

        if x==1:
Ejemplo n.º 6
0
def main():
    run = 1
    db_helper.create_table()
    while run:
        print(
            "1.insert the value\n2.printing the value\n3.deleting the value \n4.exit"
        )
        choice = input("enter u r choice : ")
        if choice == "1":
            task = str(input("enter the todo: \n"))
            db_helper.data_entry(task)
        elif choice == "2":
            db_helper.printData()
        elif choice == "3":
            userid = str(input("enter the todo's userid to be deleted: \n"))
            db_helper.deleteTask(userid)
        elif choice == "4":
            run = 0
        else:
            print("enter the valid choice")

    db_helper.closeCursor()
Ejemplo n.º 7
0
 def create_db(self):
     self._sql = "social_network_ip_links"
     db_helper.create_table(self._sql)
Ejemplo n.º 8
0
from helper_functions import isValidPhoneNumber
import sqlite3

from db_helper import create_table
from add import add
from view import view
from edit import edit
from deletee import deletee
from search import search

db = sqlite3.connect("contacts.db")
create_table(db, 'contact', name='text', number='text')


def runApp():
    while True:
        print(
            "what you want to do ?\n1.Add Contact\n2.View all Contacts\n3.Edit Contact\n4.Delete Contact\n5.Search Contact\n6.Exit"
        )
        choice = int(input())
        if choice == 1:
            name = input("Enter a name : ")
            number = input("Enter Contact number : ")
            while not isValidPhoneNumber(number):
                print("Enter a valid phone number")
                number = input("Enter Contact number : ")
            add(name, number)
            print("contact added successfully")
        elif choice == 2:
            view()
        elif choice == 3:
Ejemplo n.º 9
0
 def __init__(self):
     self.conn = sqlite3.connect("amazon.db")
     self.cur = self.conn.cursor()
     create_table(self.cur)