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.
This commit is contained in:
Ray 2023-09-17 16:54:11 +10:00
commit 61d86dc0cb
15 changed files with 186 additions and 0 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

8
arrayDEMO.py Normal file
View File

@ -0,0 +1,8 @@
salaries=[]
salaries.append(10000)
salaries.append(20000)
salaries.append(30000)
salaries.append(10000)
for x in salaries:
print(x)

13
bankBalance.py Normal file
View File

@ -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")

19
computeNetPay.py Normal file
View File

@ -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

33
doggieDaycare.py Normal file
View File

@ -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))

12
furniture.py Normal file
View File

@ -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.")

19
input1234.py Normal file
View File

@ -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()

23
iq.py Normal file
View File

@ -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.")

13
movieTicket.py Normal file
View File

@ -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.")

12
passFail.py Normal file
View File

@ -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!")

16
purchase.py Normal file
View File

@ -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.")

8
testScore.py Normal file
View File

@ -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")

10
vowel.py Normal file
View File

@ -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")