Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

# Coding for Veterans: Intermediate Python Assignment 1 # By: Mike Mawson # Due Date: 12 July 2020 # Finished: 11 July 2020 # Imports import csv def user_input(): choice = input('\nPlease choose...

1 answer below »
# Coding for Veterans: Intermediate Python Assignment 1
# By: Mike Mawson
# Due Date: 12 July 2020
# Finished: 11 July 2020
# Imports
import csv
def user_input():
choice = input('\nPlease choose operation: \n \n 1 : Enter car details \n 2 : Exit')
if choice == '1':
XXXXXXXXXXmake = input("Enter car make: ")
XXXXXXXXXXmodel = input("Enter car model: ")
XXXXXXXXXXyear = int(input("Enter car year: "))
XXXXXXXXXXperson = input("Enter sales person: ")
XXXXXXXXXXprice = float(input("Enter sales price: "))
XXXXXXXXXXcar_details = {'Car Make': make, 'Car Model': model, 'Car Year': year,
'Sales Person': person, 'Sales Price': price}
XXXXXXXXXXreturn car_details
# if user chooses 2, exit program
elif choice == '2':
XXXXXXXXXXraise Exception
while True:
# Take user input
XXXXXXXXXXcar_details = user_input()
XXXXXXXXXXif car_details:
# Read file and add details to it
XXXXXXXXXXwith open('carSales.csv', mode='a') as csv_file:
XXXXXXXXXXfieldnames = ['Car Make', 'Car Model','Car Year','Sales Person','Sales Price']
XXXXXXXXXXwriter = csv.DictWriter(csv_file, fieldnames=fieldnames)
XXXXXXXXXXprint('Car Details Entered Successfully.\n')
XXXXXXXXXXprint('Exiting Program. Thank You.')

except IOE
or: E
or while opening CSV file.")

except (TypeE
or, ValueE
XXXXXXXXXXprint('Enter co
ect values. Try Again.')
except Exception as e:
XXXXXXXXXXprint('Please choose co
ect option.')

Intermediate Python
Assignment 4
Due Date: December 15st by 11:30PM
The objective of every assignment is to make sure you practice what we learned throughout the
modules to cement your learning. Every assignment is based on a real-life scenario to prepare
you for a job in the industry. Assignment 4 covers topics that we will cover in modules 5,6, and
The car dealership from Assignment 1 is not happy with the Python console-based application
that you have created and would like to upgrade a few features.
Instead of utilizing the Python console to input the information, they would like their employees
to have a GUI to enter the exact same information from assignment 1. Additionally, the
dealership no longer wants to rely on a CSV file and wants to upgrade the program so that it
stores all the information on a database.
You must create text fields with labels (e.g., Car Make) so that the car dealership employee can
input the relevant information. You must also create a submit button; that when clicked, the data
is saved to a local database created in PHPMyAdmin. This means that you need to create a
database table with the appropriate columns.
Just like Assignment 3, you must screenshot the database table after you have added information
to it using your Python program to prove that the program works!
• Commented Python code file (.py)
• Screenshot of the database (.png or .jpeg)
• Screenshot of your git logs to prove that you have been utilizing git to backup your code
throughout the development process.
• As always, your files must be zipped into one zip file named
studentNumber_studentName_Assignment4 and submitted via D2L by the deadline.
Answered Same Day Jul 29, 2021


Sanghamitra answered on Jul 31 2021
115 Votes
import tkinter as tk
from tkinter import ttk
import mysql.connecto
#mysql database connection
db = mysql.connector.connect(
cursor = db.cursor()
class Example:
def __init__(self):

#setup the window default property
window.title('Intermediate Python::Assignment 4')
window.wm_minsize(150, 150)

#render form in window starts here
self.save_btn = ttk.Button(window, text='Save',, y=365)
# Labels ------------------------------------------
self.make = ttk.Label(window, text='Enter car make:', width=90), y=50 )
self.model = ttk.Label(window, text='Enter car model:'), y=100)
self.year = ttk.Label(window, text='Enter car year:',width=20), y=150)

self.person = ttk.Label(window, text='Enter sales person:'), y=200)

self.price = ttk.Label(window,...

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here