Laura Sach

Laura Sach

Laura creates and maintains Raspberry Pi educational resources. Aside from computers, she loves cats, cakes, board games and making jam.

Location UK

Activity

  • Hi @SamirHussen - it looks like you’ve got a missing closing bracket at the end there?

  • Hi @ImaadMalik - did you copy the shapes code from the link and save it as shapes.py in the same folder as your code?

  • Hi Carol, have a look at this project - https://projects.raspberrypi.org/en/projects/getting-started-with-git - it should get you started with the basics. If you’re using Windows I would highly recommend downloading the GitHub client for Windows because it makes the process very easy.

  • Ahh! You add the getters and setters (and any other methods) inside the class. So this means they need to be indented and begin somewhere after the line class Room():

  • Hmm, I’m not sure @EmmaGeorge - it sounds like if the text turns black it’s not being recognised as a Python file! Very strange.

  • I am absolutely loving that you’ve provided a changelog of what you have added with your code updates, so helpful! :)

  • Glad it’s sorted Carol. :)

  • Hooray! :D

  • Brill, glad you got it sorted! :)

  • I think your description property needs to be the other way around - you’d return the value of self._description in the property, and then set it using the setter (which is also missing the decorator). But the name one looks spot on!

  • How can I help @Laurence<3~Beven~ - could you explain a little more about what’s confusing you?

  • Thanks @AnkitaNegi this is a really helpful reply. Yes, the best way in Python is to specify parameters with a default value, which makes them optional.

  • Hi @SebH please would you be able to post your full code so we can have a look and help you? That error message means that you’re trying to run the method on a string, rather than an instance of the room object.

  • Sorry @CarolWareing I missed your reply! I tried your code and the problem is that when you state the position of the shape you use set_X (capital X) but the method uses a lowercase x. If you change it to lowercase you’ll get both the blue and yellow rectangles. A really tricky one to spot, but (depending on which code editor you’re using) you should get an…

  • Absolutely right. The get_details() method doesn’t specify a return value, so Python is automatically returning None. So by using the print statement around the call to the method you’re effectively saying please print out whatever this method returns…which is nothing.

  • Hi @PragyaM - you’re clearly thinking along some good lines because this stuff is coming up later in the course!

    1) If you look at week 3 of the course, we make the loop a little more complicated there than just an infinite loop
    2) What you could do is convert the whole input to lowercase, like this:

    command = input("> ").lower()

    This means that…

  • Hmm, sorry about that @MiguelGuerrero - I’ve asked the team to check it out!

  • Looks pretty good to me! :D I think probably the only way you could make it shorter would be to use a list and loop through the list. I had a quick go, something like this:

    ~~~
    nombres = [“Juan”, “Diego”, “Sara”, “Santi”]
    tortugas = [0, 0, 0, 0]

    for movement in range (100):

    corre = [randint(1,5), randint(1,5), randint(1,5),...
    
  • Aha, yes, OOP does come up a lot, so it’s a good thing to understand the principles of :)

  • LAURAence :D :D

  • Hi @CarolWareing , what happens when you try to run the program?

  • Hi @SamirHussen - have you checked whether you used a capital letter when you created the Lauren turtle, or did you write lauren? The case of the letters matters. If that’s not it, perhaps you could post your whole code so we can have a look and help?

  • Hi @SantiagoSánchez - if you want to keep track of the winner, take a look at the part of the code which begins ‘for movement in range(100):’. Inside this loop you generate a random number for each of the turtles each time the loop runs. If you create variables (or indeed a list) to add up the random number generated each time for each turtle, at the end of…

  • Hi Carol. This course does indeed assume you have some existing Python knowledge. If you’re looking for a beginners Python course, have a look at Programming 101 - https://www.futurelearn.com/courses/programming-101

  • Hello and welcome to the course! I’m Laura and I’ll be here each day to see how you’re getting on and help if it’s needed. I work at the Raspberry Pi Foundation but previously I was a secondary classroom teacher of Computer Science. I hope you enjoy the course :)

  • Hi @VictorinoJulio - if this is your first time using Python, may I recommend that you take the Programming 101 course first, because this course assumes you already know some basics of Python? https://www.futurelearn.com/courses/programming-101

  • Hello @14黄帝安.Benedict. I’ve just run your code and it works absolutely fine. The triangle doesn’t draw but you just need to add () after the triangle.draw part to make that happen. I think it’s likely that you haven’t copied the shapes.py file according to the instructions above, or it is not in the same folder? Try that part again perhaps to check?

  • Hi @14黄帝安.Benedict. - please could you share your code so that we can help you? You can paste it into a comment with ~~~ at the start and end to show that it is code, like this:

    print("Hi")
    
  • @KT Yes you can use Thonny as well. Any Python IDE that you like using is fine.

  • Hi @HannahPitts - if this is your first time using Python I would recommend you start with the Programming 101 course instead. This course assumes you already have some Python knowledge. https://www.futurelearn.com/courses/programming-101

  • Interestingly, your two string methods .upper() and .lower() are methods, but len() is odd because it is a built in function rather than a method on a string. You can tell because the first two are used as xxx.upper() whereas len is used as len(xxx) where in both cases xxx is the string.

  • The brackets at the end imply that the things you’ve listed above are methods - i.e. you can call them upon the object and they perform some task and potentially return some information. Attributes do not have brackets because they store a value (or multiple values depending on the data type).

  • Yes that is fine

  • Hi @MichaelDorner - if this is your first time using Python I would recommend you try the Programming 101 course first, as this course assumes you already have some Python knowledge. https://www.futurelearn.com/courses/programming-101

  • This means that Python expected to see the line after the one indicated to be tabbed in. This happens if you’ve put in your ‘for’ loop, but not then indented the lines of code which are supposed to be inside it. If you can post the whole code which causes the error we’ll be able to have a look and help you.

  • Hello and welcome everyone! I’m Laura and I’ll be facilitating this run of the course. I’ll stop by every day to see how you are all getting on and to hopefully answer any questions. Hope you enjoy it! :)

  • Hopefully all of those things are covered in this course! You can use something different than ‘self’ - Python will let you, but it isn’t a good idea because almost every resource and programmer you will find uses self, so you will probably end up confusing yourself!

  • Hi @WilliamTate - welcome. If you’re a complete beginner you might want to start with Programming 101 instead and come back here later, as this course assumes some prior knowledge of Python https://www.futurelearn.com/courses/programming-101

  • @YuWaiLuo Data link layer :)

  • Hi @YuWaiLuo I'll try to answer :)

    Q1 - HTTPS is an application layer protocol
    Q2 - If person A (sender) is sending a message to person B (receiver), they encrypt the message using B's public key which B has published for anyone to see. B already knows their own private key which is used to decrypt the message.

    HTTPS encrypts the data exchanged between...

  • Crikey you have eagle eyes Max! I just did the quiz to check and I didn't even spot it the first time. Yes, they are all supposed to be bytes, I'll get that changed. Thank you for flagging it up.

  • @NyreeScott Have you tried any of our other courses on Python - the Programming 101 course is a great place to start!

  • Hi Aichatou, nice to see you on the course. Please would you be able to comment in English on this course, so that you can chat with the other learners? Many thanks! :)

  • I'm guessing that the answer of 5 comes from looking in the table, seeing 10, moving across and seeing 5 next to it and not looking at the column headings?

  • Hi @MuskanChadda - not sure if you saw my comment below. A kilobit is 1000bps, and a kibibit is 1024bps. So the abbreviation 1kbit/s would refer to 1000 bits per second.

  • Why do you think that might be?

  • What were your thoughts?

  • Hola Lender. Por favor, tiene que hablar en inglés en este curso para aprender y hablar con las otras personas que están haciendo el curso :)

  • A kilobit is 1000bps, and a kibibit is 1024bps. So the abbreviation 1kbit/s would refer to 1000 bits per second.

  • Hi everyone, welcome to the course! Mac Bowley and I will be your facilitators for this course, we'll try to help with any questions you might have along the way.

  • @ZoobiaAbbasi Please could you share your code (use a site like pastebin.com) so that we can help you?

  • Hi @CostanzaSaraBrevini - please could you share your code so that we can have a look and help you?

  • Hi @LorraineNelson - it looks like you've saved your shell as the Python file. You'll need to delete any lines at the top of the file which say things like Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 22:45:29) [MSC v.1916 32 bit (Intel)] on win32 and make sure your first line of code is the 'from shapes import..." line.

  • Hi @AnnaParry this course assumes you know some basics of Python. I would highly recommend you begin with Programming 101 if you don't already know any Python - https://www.futurelearn.com/courses/programming-101

  • Hello! :)

  • Hi @PaulBoyson - what this line of code means is:
    self - for this object...
    .linked_rooms - in its linked_rooms dictionary...
    [direction] - in the direction specified...
    = room_to_link - this other object is the room you will go to if you travel in the direction specified from this object

  • Hi @MidhatAshraf - you should be able to get the turtle using trinket. If you look at the example project linked at the end, there is a trinket embedded there and it uses turtles - https://projects.raspberrypi.org/en/projects/turtle-race

  • Hi @RandellEvans - not sure what you mean, which programs are you referring to? The Turtle program is above, you need to copy it into your code editor and run it.

  • Hi @AntoGnanaJaslinPradeepaA - this is not a beginners course, I would recommend you start with this course if you are a complete beginner to Python - https://www.futurelearn.com/courses/programming-101

  • Hi Robert, this is not a beginners course - as it says at the start, it assumes you already have a working knowledge of Python. Well done for completing the course!

  • Hi @FredWireko - in your Room class, in the __init__ method, is there a parameter specified? i.e. does it look like this:

    def __init__(self, room_name):

    ...or is room_name missing?

  • Hi @PeterStory - I think the code for that would depend on the operating system you are using and the IDE you are using to run Python. Are you using IDLE? You could try maximising the shell window?

  • Sure, by all means do that! This is a beginners OOP course, so we've done things that are simple and familiar.

  • Did you get an error message? Could you share your code using either trinket or something like pastebin.com ?

  • Hi @LuciMartinStValery - please could you post your whole code, either on trinket or pastebin or similar? It's hard to work out what is wrong without seeing the problem in context.

  • Yup! It's showing you that there is a room object linked, and the 0x bit is the memory address of where that room object is stored.

  • The return statement in the move method returns the room in the direction you chose. That value is then assigned to current_room inside the while True loop in the main program. Hence, the current room becomes that room! :) Remember that self._linked_rooms contains ONLY the linked rooms for this particular room object, e.g. if the current room is the kitchen,...

  • Oooh that's a really interesting idea

  • That's a good point, I wasn't explicit about that. Will add it to our list of improvements :)

  • Why not - you can now use the things you have learnt to extend the game in any way you want. This is just the start!

  • @JohnLucas Take a look on the Code Club website and see if there are any schools wanting a volunteer in your area. You will already have plenty of experience to help run a code club :) https://codeclub.org/en/

  • I have to say, I don't actually know the answer to this! :)