Wednesday, March 6, 2019

Accept and Displays Values Using Lists in Python

Write a program using a list that will accept ten integer values and then the program will display all the ten integer values given by the user on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

# list.py
# Rollyn M. Moises and Jake R. Pomperada
# March 1, 2019   Friday
# Bacolod City, Negros Occidental

memo=[]
print();
print("\t Accept and Displays Values Using Lists");
print();
for i in range (10):
    x=int(input("\t Give value in item no. {0} : ".format(i+1)))
    memo.insert(i,x)
    i+=1;

print();
print("\t The List of Values")
print();
print("\t",memo);
print();
print("\t END OF PROGRAM");



Login Application in Python and MySQL

In this article, we would like to share with you guys a login program written by me and my best friend Rolly M. Moises to log in using Python and MySQL. The code is very easy to use and understand.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com




Sample Program Output


Program Listing

# Rollyn M. Moises and Jake R. Pomperada# Login Application in Python and MySQL# Tools            : PyCharm Community Edition 2018.3# Date             : March 6, 2019  Wednesday# Place of Origin  : Bacolod City, Negros Occidental Philippines# Website          : http://www.jakerpomperada.com
import pymysql
import getpass

connection = pymysql.connect(
    host='localhost',
    port=3306,
    user='root',
    password='',
    db='school_management',
)

def login():
 print("==== LOGIN SECURITY SYSTEM =====");
 print();
 user = input("Enter Username : ")
 password = getpass.getpass(prompt='Enter Password :')
 print("\n");
 query_db(user, password)


def query_db(username, pwd):

   try:
      with connection.cursor() as cursor:
         sql = "SELECT * FROM users WHERE username = %s and password = %s"         try:
            rows = cursor.execute(sql, (username, pwd,))
            if rows > 0:
             print("Login successful in the system.")

            else:
               print();
               print("Invalid username and/or password.")
               print();
               print();
               login()
         except:
            print("Unable to fetch records")
 
      connection.commit()
   finally:
      connection.close()
   print("\n");
   input("PRESS ENTER KEY TO CONTINUE")

print()
login()


school_management.sql

-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 06, 2019 at 02:17 AM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.0

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `school_management`
--

-- --------------------------------------------------------

--
-- Table structure for table `student`
--

CREATE TABLE `student` (
  `id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `course` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `student`
--

INSERT INTO `student` (`id`, `name`, `course`) VALUES
(2, 'Jake Pomperada', 'Master in Information Technology'),
(3, 'Rollyn M. Moises', 'Master of Science in Computer Science');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(100) DEFAULT NULL,
  `password` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`) VALUES
(1, '123', '123'),
(2, 'admin', 'admin');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `student`
--
ALTER TABLE `student`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `student`
--
ALTER TABLE `student`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;



Menu Driven CRUD in Python and MySQL

A simple menu driven crud program that we wrote together with my mentor in programming and best friend Rollyn M. Moises for our upcoming book in Python programming.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com











Sample Program Output


Program Listing

# Rollyn M. Moises and Jake R. Pomperada# CRUD Application in Python and MySQL
# Tools            : PyCharm Community Edition 2018.3
# Date             : March 6, 2019  Wednesday
# Place of Origin  : Bacolod City, Negros Occidental Philippines
# Website          : http://www.jakerpomperada.com

import pymysql
import subprocess as sp

connection = pymysql.connect(
    host='localhost',
    port=3306,
    user='root',
    password='',
    db='school_management',
)

def add_record():
   print();
   print("ADD STUDENT RECORD")
   print();
   name = input("Enter Student Name     : ")
   course = input("Enter Student Course   : ")
   print();
   try:
      with connection.cursor() as cursor:
         sql = "INSERT INTO student (`name`, `course`) VALUES (%s, %s)"         try:
            cursor.execute(sql, (name, course))
            print("Student added successfully")
         except:
            print("Unable to save student record")
      connection.commit()
   finally:
      print("") #connection.close()
def select_records():
   
   try:
      with connection.cursor() as cursor:
         sql = "SELECT `id`, `name`, `course` FROM student"         try:
            cursor.execute(sql)
            result = cursor.fetchall()
            print();
            print("VIEW STUDENT RECORDS")
            print();
            print("ID\t\t NAME\t\t\t\t\t\t\t\tCOURSE")
            print("---------------------------------------------------------------------------")
            for row in result:
               print(str(row[0]) + "\t\t" + row[1] + "\t\t\t" + row[2])
 
         except:
            print("Unable to fetch records")
 
      connection.commit()
   finally:
      print("") #connection.close()
def delete_input():
   print();
   print("DELETE STUDENT RECORD")
   print();
   id = input("Enter Student ID         : ")
   print();
   delete_record(id)

def delete_record(id):

   try:
      with connection.cursor() as cursor:
         sql = "DELETE FROM student WHERE id = %s"         try:
            cursor.execute(sql, (id,))
            print("Successfully Deleted the Record...")
         except:
            print("Unable to delete record")
 
      connection.commit()
   finally:
      print("") #connection.close()

def update_input():
   print()
   print("UPDATE STUDENT RECORD")
   print();
   id = input("Enter Student ID         : ")
   name = input("Enter Student Name       : ")
   course = input("Enter Student Course     : ")
   print();
   update_record(id, name, course)

def update_record(id, name, course):

   try:
      with connection.cursor() as cursor:
         sql = "UPDATE student SET `name`=%s, `course`=%s WHERE `id` = %s"         try:
            cursor.execute(sql, (name, course, id))
            print("Successfully Updated the Record...")
         except:
            print("Unable to update record")
 
      connection.commit()
   finally:
      print("") #connection.close()
def exit_app():
   print();
   print("\tThank you for using this software.");
   print();
   connection.close()

def menu_option():
   ch = "0"   while ch != "5":
      tmp = sp.call('cls',shell=True)
      print();
      print("===== STUDENT RECORD SYSTEM =====");
      print();
      print("1. Add Student Record")
      print("2. Update Student Record")
      print("3. Show Student List Record")
      print("4. Delete a student Record")
      print("5. Quit Program ")
      print();
      ch = input("Select option : ")
      menu_selection = {
         "1": add_record,
         "2": update_input,
         "3": select_records,
         "4": delete_input,
         "5": exit_app
      }  
      func = menu_selection.get(ch)
      if func is not None:
         func()
      else:
         print("Invalid option selected")
      print();
      input('PRESS THE ENTER KEY TO CONTINUE ')

menu_option()


school_management.sql

-- phpMyAdmin SQL Dump
-- version 4.8.4
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 06, 2019 at 02:17 AM
-- Server version: 10.1.37-MariaDB
-- PHP Version: 7.3.0

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `school_management`
--

-- --------------------------------------------------------

--
-- Table structure for table `student`
--

CREATE TABLE `student` (
  `id` int(11) NOT NULL,
  `name` varchar(100) DEFAULT NULL,
  `course` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `student`
--

INSERT INTO `student` (`id`, `name`, `course`) VALUES
(2, 'Jake Pomperada', 'Master in Information Technology'),
(3, 'Rollyn M. Moises', 'Master of Science in Computer Science');

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(100) DEFAULT NULL,
  `password` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`) VALUES
(1, '123', '123'),
(2, 'admin', 'admin');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `student`
--
ALTER TABLE `student`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `student`
--
ALTER TABLE `student`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;





Monday, March 4, 2019

Example No. 2 using Two Dimensional List in Python

To append a new list of values into a two-dimensional list in Python example.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing

# example2.py
# Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tExample No. 2 using Two Dimensional List");
print();
list_example = [[1,2,3], [4, 5, 6],[7,8,9,10]]
list_example.append([11,12,13,14,15])
print("\tDisplay Result")
print();
print("\t",list_example);
print();
print("\tEND OF PROGRAM")



Odd and Even Numbers using Two Dimensional List in Python

Write a program that will ask the user how many values to be processed. The program also will ask the user to give integer values using two-dimensional list and check which of the given number is odd or even numbers being provided by the user and display the result on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing



# odd_even.py
# Rollyn M. Moises and Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tOdd and Even Numbers using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tList of EVEN Numbers");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] % 2 == 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\t List of ODD Numbers");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] % 2 != 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tEND OF PROGRAM")

Passed and Failed Grade Checker Using Two Dimensional List in Python

Write a program that will ask the user how many values to be processed. The program also will ask the user to give a series of grade values using a two-dimensional list and check which of the given grade is passed or failed. Furthermore, the program will list down the passed and failed grade on the screen.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com




Sample Program Output


Program Listing


# grades.py
# Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tPassed and Failed Grade Checker Using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tList of PASSED Grades");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] >= 75:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tList of FAILED Grades");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] < 75:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tEND OF PROGRAM")






Positive and Negative Number Lister Using Two Dimensional List in Python


Write a program that will ask the user how many values to be processed. The program also will ask the user to give a series of grade values using the two-dimensional list and check which of the given number is positive or negative in terms of numerical value and display the result on the screen.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Sample Program Output


Program Listing


# positive_negative.py
# Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tPositive and Negative Number Lister Using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tList of Positive Number");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] >= 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tList of Negative Number");
print();
for i in range(len(accept)):
    for j in range(len(accept[i])):
        if accept[i][j] < 0:
         print("\t",accept[i][j], end=" ")
print("\n");
print("\tEND OF PROGRAM")

Maximum and Minimum Numbers Using Two Dimensional List in Python

A very simple program that I wrote using Python that will ask the user to give a series of number and then the program determine and check which of the series of number has the maximum and minimum value and display the result using the two-dimensional list in python.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting.

work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Sample Program Output


Program Listing

# max_min.py
# Jake R. Pomperada
# March 4, 2019   Monday
# Bacolod City, Negros Occidental
print();
print("\tMaximum and Minimum Numbers Using Two Dimensional List");
print();
num = int(input('\tHow many numbers: '))
print();
accept = []
for a in range(0,num):   #row
    accept.append([])
for b in range(0,num) : # row
    for c in range(0,1) : # column
        accept[b].append(c);
        accept[b][c]=0;

for b in range(0,num) : # row
    for c in range(0,1) : # column
         accept[b][c]=int(input("\tGive value in item no. {0} : ".format(b+1)));

print();
print("\tDisplay Result")
print();
print("\tThe maximum number is {0}. ".format(max(accept)));
print();
print("\tThe minimum number is {0}. ".format(min(accept)));
print();
print("\tEND OF PROGRAM")