diff --git a/11/exercise-01.py b/11 Random Options/exercise-01.py similarity index 100% rename from 11/exercise-01.py rename to 11 Random Options/exercise-01.py diff --git a/11/task.png b/11 Random Options/task.png similarity index 100% rename from 11/task.png rename to 11 Random Options/task.png diff --git a/12 Create a Shape/exercise-01.py b/12 Create a Shape/exercise-01.py new file mode 100644 index 0000000..21499b2 --- /dev/null +++ b/12 Create a Shape/exercise-01.py @@ -0,0 +1,30 @@ +import turtle + +my_screen = turtle.Screen() +terry = turtle.Turtle() + +# Regular octagon in red +terry.pencolor("red") +terry.pendown() + +count = 0 +while count < 8: + terry.forward(50) + terry.right(45) # 360 / 8 + count += 1 + +# Move turtle so shapes don't overlap +terry.penup() +terry.forward(200) + +# Regular nonagon in blue +terry.pencolor("blue") +terry.pendown() + +count = 0 +while count < 9: + terry.forward(50) + terry.right(40) # 360 / 9 + count += 1 + +my_screen.exitonclick() \ No newline at end of file diff --git a/12/task.png b/12 Create a Shape/task.png similarity index 100% rename from 12/task.png rename to 12 Create a Shape/task.png diff --git a/12/exercise-01.py b/12/exercise-01.py deleted file mode 100644 index d079c8f..0000000 --- a/12/exercise-01.py +++ /dev/null @@ -1,8 +0,0 @@ -# regular octagon in red -# regular nonagon in blue - -# condition controlled iteration -# both shapes on same screen - -import turtle - diff --git a/13/image.png b/13 Slices/task.png similarity index 100% rename from 13/image.png rename to 13 Slices/task.png diff --git a/14 Practice in the Shell/task.png b/14 Practice in the Shell/task.png new file mode 100644 index 0000000..dbdc398 Binary files /dev/null and b/14 Practice in the Shell/task.png differ diff --git a/14/image.png b/14/image.png deleted file mode 100644 index a59d3d3..0000000 Binary files a/14/image.png and /dev/null differ diff --git a/15 Practice in the Python Shell/task.png b/15 Practice in the Python Shell/task.png new file mode 100644 index 0000000..e2926f2 Binary files /dev/null and b/15 Practice in the Python Shell/task.png differ diff --git a/15/image.png b/15/image.png deleted file mode 100644 index 6cf561b..0000000 Binary files a/15/image.png and /dev/null differ diff --git a/16/image.png b/16 Checking items in a List/task.png similarity index 100% rename from 16/image.png rename to 16 Checking items in a List/task.png diff --git a/17 Simple Menu/task.png b/17 Simple Menu/task.png new file mode 100644 index 0000000..2311f5d Binary files /dev/null and b/17 Simple Menu/task.png differ diff --git a/18 Putting it all Together/task.png b/18 Putting it all Together/task.png new file mode 100644 index 0000000..fb60bb9 Binary files /dev/null and b/18 Putting it all Together/task.png differ diff --git a/19 Develop the Favourite Foods Program/exercise-01.py b/19 Develop the Favourite Foods Program/exercise-01.py new file mode 100644 index 0000000..1c2202f --- /dev/null +++ b/19 Develop the Favourite Foods Program/exercise-01.py @@ -0,0 +1,18 @@ +# Initialize as a clean empty list +foods = [] + +run = True +while run: + name = input("Enter a name: ") + food = input("Enter a favourite food: ") + foods.append([name, food]) + + user_choice = input("Would you like to add another student? (y/n): ") + if user_choice.strip().lower() == "n": + run = False + +# Print in tabular format +print("\nName - Favourite Food") +print("-" * 25) +for person in foods: + print(f"{person[0]} - {person[1]}") \ No newline at end of file diff --git a/19 Develop the Favourite Foods Program/task.png b/19 Develop the Favourite Foods Program/task.png new file mode 100644 index 0000000..1ea21a2 Binary files /dev/null and b/19 Develop the Favourite Foods Program/task.png differ diff --git a/20 Fundraiser part 1/excerise-01.py b/20 Fundraiser part 1/excerise-01.py new file mode 100644 index 0000000..d704edc --- /dev/null +++ b/20 Fundraiser part 1/excerise-01.py @@ -0,0 +1,56 @@ +# loop: +# ask for name max length 10 (retry until suitable) +# ask for amount (hourly) (between 99p and £5.99) (retry until suitable) +# after user confirms they are done entering data, +# print out the data in tabular format with suitable column headings +# use main() function and functions with docstrings + +def get_name(): + collect = True + while collect: + name = input("Enter the activity: ") + if len(name) > 10: + print("Name too long. Please try again.") + continue + else: + collect = False + return name + +def get_amount(): + collect = True + while collect: + amount = float(input("Enter activity hourly rate in pence: ")) + # if less than 99 pence or greater than 599 + if amount < 99 or amount > 599: + print("Amount out of range. Please try again.") + continue + else: + collect = False + return amount + +def print_data(data): + print("\nActivity - Amount") + print("-" * 15) + for activity in data: + print(f"{activity[0]} - {f"£{activity[1]/100}"}") + +def main(): + run = True + + data = [] + + while run: + activity = get_name() + amount = get_amount() + print(f"{activity} - {f"£{amount/100}"}") + user_choice = input("Would you like to add another activity? (y/n): ") + if user_choice.strip().lower() == "n": + run = False + + data.append([activity, amount]) + + print_data(data) + +if __name__ == "__main__": + main() + \ No newline at end of file diff --git a/20 Fundraiser part 1/task.png b/20 Fundraiser part 1/task.png new file mode 100644 index 0000000..213e1ab Binary files /dev/null and b/20 Fundraiser part 1/task.png differ