commit 61d86dc0cbd35d3abe0df661c750f39646b17d65 Author: Rayyan (Rayy) Date: Sun Sep 17 16:54:11 2023 +1000 Added python scripts and manuals I have uploaded the python scripts I have created, some were complete, some were incomplete. I have added the instructional documents for reference. diff --git a/Python Looping - Lab Manual_TAFE.docx b/Python Looping - Lab Manual_TAFE.docx new file mode 100644 index 0000000..225872a Binary files /dev/null and b/Python Looping - Lab Manual_TAFE.docx differ diff --git a/Python Making Decisions Part 1 - Lab Manual_TAFE.docx b/Python Making Decisions Part 1 - Lab Manual_TAFE.docx new file mode 100644 index 0000000..5f0220b Binary files /dev/null and b/Python Making Decisions Part 1 - Lab Manual_TAFE.docx differ diff --git a/Python Making Decisions Part 2 - Lab Manual_TAFE.docx b/Python Making Decisions Part 2 - Lab Manual_TAFE.docx new file mode 100644 index 0000000..1d6d16e Binary files /dev/null and b/Python Making Decisions Part 2 - Lab Manual_TAFE.docx differ diff --git a/arrayDEMO.py b/arrayDEMO.py new file mode 100644 index 0000000..8917469 --- /dev/null +++ b/arrayDEMO.py @@ -0,0 +1,8 @@ +salaries=[] +salaries.append(10000) +salaries.append(20000) +salaries.append(30000) +salaries.append(10000) + +for x in salaries: + print(x) \ No newline at end of file diff --git a/bankBalance.py b/bankBalance.py new file mode 100644 index 0000000..b1099fb --- /dev/null +++ b/bankBalance.py @@ -0,0 +1,13 @@ +#Obtain bank and savings balance from user +checkingbal=int(input("Please enter your checking balance: ")) +savingsbal=int(input("Please enter your savings balance: ")) + +#Checking if users checking balance is low +if checkingbal <50: + print("Checking account balance is low") + +#Checking if users savings balance is low +if savingsbal <100: + print("Savings account balance is low") + + diff --git a/computeNetPay.py b/computeNetPay.py new file mode 100644 index 0000000..a23ed0f --- /dev/null +++ b/computeNetPay.py @@ -0,0 +1,19 @@ +#Detemrining user's hourly pay rate, number of hours worked, gross pay, withoholding tax percentage, witholding tax and net pay. +hourlypayrate=int(input("Please enter your hourly pay rate: ")) + + + +#Calculate each variable + +if dogsize < 3 and stay < 11: + daycost = 15 +elif dogsize < 3 and stay > 10: + daycost = 12 +elif dogsize >= 3 and dogsize <= 10 and stay < 11: + daycost = 20 +elif dogsize >= 3 and dogsize <= 10 and stay > 10: + daycost = 17 +elif dogsize > 10 and stay < 11: + daycost = 25 +elif dogsize >10 and stay > 10: + daycost = 22 \ No newline at end of file diff --git a/doggieDaycare.py b/doggieDaycare.py new file mode 100644 index 0000000..dc6b80b --- /dev/null +++ b/doggieDaycare.py @@ -0,0 +1,33 @@ +#Obtain Dog size and length of stay +dogsize=int(input("Please enter your dog's weight: ")) +stay=int(input("How long will your dog will stay with us: ")) + +#Calculate overall cost of dog stay with information supplied +if dogsize < 3 and stay < 11: + daycost = 15 +elif dogsize < 3 and stay > 10: + daycost = 12 +elif dogsize >= 3 and dogsize <= 10 and stay < 11: + daycost = 20 +elif dogsize >= 3 and dogsize <= 10 and stay > 10: + daycost = 17 +elif dogsize > 10 and stay < 11: + daycost = 25 +elif dogsize >10 and stay > 10: + daycost = 22 + +monthcost = daycost * stay + +#Print final cost with error check for invalid information. +if dogsize==0 or stay==0: + print("Invalid information, please enter valid information.") +else: + print("Daily cost = $"+str(daycost)) + print("Monthly cost = $" + str(monthcost)) + + + + + + + diff --git a/furniture.py b/furniture.py new file mode 100644 index 0000000..84c1001 --- /dev/null +++ b/furniture.py @@ -0,0 +1,12 @@ +#Getting user to choose type of wood +woodtype=int(input("Please select the type of wood you would like to use (1 for pine, 2 for oak): ")) + +#Defining answer +answer=woodtype + +#Determining answer +if woodtype <2: + print("You have selected pine wood The pine table will cost you $100.") + +if woodtype >1: + print("You have selected oak wood. The oak table will cost you $285.") \ No newline at end of file diff --git a/input1234.py b/input1234.py new file mode 100644 index 0000000..7a1970f --- /dev/null +++ b/input1234.py @@ -0,0 +1,19 @@ +# Obtain answer from user and determining that within our code. +number=int(input("Please enter a number ranging from 1 to 4: ")) +i = number + +# If answer is either 1, 2 or 3, this section prints "Good Job!" and continues asking the user to provide a number +# until the user types out a number bigger than 3 or exits the program. +if number <4: + print("Good Job!") +loop() + + +# If the answer is bigger than 4, print an error stating that an invalid entry was submitted. +if i > 4: + print("This is an invalid entry, please try again.") + +# If the answer is 4, terminate the program with no message. +if i == 4: + breakpoint() + diff --git a/iq.py b/iq.py new file mode 100644 index 0000000..e686118 --- /dev/null +++ b/iq.py @@ -0,0 +1,23 @@ + +#ISSUE: INVALID IQ AND BELOW AVERAGE TRIGGER WHEN INVALID ANSWER GIVEN + +#Obtaining and defining IQ +iq=int(input("Please enter your IQ: ")) +answer=iq + +#Invalid IQ Error +if answer<0 or answer>200: + print("Error: Invalid IQ") + + +#Below Average IQ +if answer<100 and answer>-1: + print("You have below average IQ.") + +#Average IQ +if answer==100: + print("You have average IQ.") + +#Above IQ Average +if answer>100 and answer<201: + print("You have above average IQ.") diff --git a/movieTicket.py b/movieTicket.py new file mode 100644 index 0000000..dadacdb --- /dev/null +++ b/movieTicket.py @@ -0,0 +1,13 @@ +#Gathering user's age and the rating they wish to view. +age=int(input("Please enter your age: ")) + +rating=input("Please enter the rating of the movie you wish to view: ") + +#Aged 12 or younger and 65 and over, therefore allowed discount on movie ticket. +if age<13 or age>64: + if rating == "g" or rating == "G": + print("You are eligible for a discounted movie ticket.") + else: print("You are NOT eligible for a discounted movie ticket") +else: + print("You are NOT eligible for a discounted movie ticket.") + diff --git a/passFail.py b/passFail.py new file mode 100644 index 0000000..fc1376e --- /dev/null +++ b/passFail.py @@ -0,0 +1,12 @@ +#Obtaining course score from user and defining it +coursescore=int(input("Please enter your test score: ")) + +#Determining if user has passed or failed course +if coursescore <50: + print("You have failed the course.") + +if coursescore >50: + print("You have passed the course!") + +if coursescore ==50: + print("You have passed the course!") diff --git a/purchase.py b/purchase.py new file mode 100644 index 0000000..bff52fc --- /dev/null +++ b/purchase.py @@ -0,0 +1,16 @@ +# Creating variables to hold the user's invoice number, sales amount and sales tax. +sales_amount=int(input("Please input the sales amount: ")) +invoice_number=int(input("Please enter your invoice number.")) + +# Making sure invoice number is within 1,000 and 8,000 +if invoice_number<1000 or invoice_number>8000: + +else: + print("Invalid invoice number, please try again.") + breakpoint() + +# Making sure sales amount is non-negative. +if sales_amount >= -1: + continue +else: + print("Invalid sales amount, please try again.") diff --git a/testScore.py b/testScore.py new file mode 100644 index 0000000..198c783 --- /dev/null +++ b/testScore.py @@ -0,0 +1,8 @@ +#Obtaining user's score +score=int(input("Please enter your test score: ")) + +#Determining users score +if score>50: + print('Congratulations, you passed your test!') + +input("Press Enter on the keyboard to exit") \ No newline at end of file diff --git a/vowel.py b/vowel.py new file mode 100644 index 0000000..5b991db --- /dev/null +++ b/vowel.py @@ -0,0 +1,10 @@ +#Prompting user to enter a letter + +letter=input("Please enter a letter to check if it is a vowel: ") + +#determining if a letter is a vowel or not. +if letter == "a"or"e"or"i"or"o"or"o"or"u"or"A"or"E"or"I"or"O"or"U": + print("OK") +else: + print("This letter is not a vowel") +