HOW TO USE TURTLE GRAPHICS IN PYTHON!

Hello, my name is Manuel and I run ManyProgramming™. Today I will be showing you how to use Turtle Graphics in Python. It is a pretty simple feature until you start getting to letters, and implementing it into a program. This blog will not be very long and will only introduce you to the basic and simplest features of Turtle Graphics like filling a shape, making a shape and lot’s of other things! We will also right words on turtle graphics. It’s pretty simple!

Firstly, I will show you how to make a simple shape, like a square. The idea is to use the curser (in Python) to draw the shape. You can also fill the shape and draw more complex shapes like circles and such.

>>> import turtle as t
>>> t.forward(50)
>>> t.left(90)
>>> t.forward(50)
>>> t.left(90)
>>> t.forward(50)
>>> t.left(90)
>>> t.forward(50)
>>> t.left(90)

Now, you may think I’m a bit strange but if you were to type this into Python, then Turtle Graphics will automatically open and will start drawing by every line of code you say. When I write ‘import turtle as t’ at the beginning, the ‘t’ is only the nickname and can be anything as long as it doesn’t have a space and, in my opinion, is short because if it’s long, then what’s the point of giving it a nickname. However, if you do give it a nickname then you have to use the nickname before you the commands; e.g. my nickname is t so I do t.forward. If me nickname was lok, then I would have to do lok.forward because it follows what my nickname is. If you don’t want to have a nickname, then you can just write ‘import turtle’ and then you will have to write turtle.forward instead of an optional nickname!

Now, you can go in any direction. The options are ‘forward’, ‘right’, ‘left’ and ‘backward’ for moving the curser and manually drawing the shapes. Now you have a huge amount of different codes in Turtle Graphics and if you’de like to see all of them then Click Here!

Next up, we will be making circles and other shapes that aren’t as easy to make with a cursor. Note: If you would like to make an equilatorial triangle, all you have to do is go left(60) / right(60) and the length has to be the same! We will also be filling up the shape.

>>> import turtle as t
>>> t.color('red')
>>> t.begin_fill()
>>> t.circle(100)
>>> t.end_fill()

Now we will get a circle with the radius of 100 and it will be filled with red. If anything is wrong or if there is anything you don’t understand then email: programmingmany@gmail.com. You can change the size of the circle by changing the number after ‘t.circle’. I used red because I know it works but many colors work. If you are unsure whether a color works or not than contact me and I will figure it out for you. Note: Wherever you curser is facing on turtle graphics, the shape will always be on the left e.g. your curser if facing your right, then the shape will be above the curser & vice-versa.

If you want to clear your Turtle Graphics then do ‘.clear()’. Obviously you need to put the nickname you gave it or turtle before the dot as I explained above but other than that if will clear the whole turtle graphics.

Lastly, we will be writing on Turtle Graphics. This isn’t the most handy but might come in handy if you are trying to make a poster for example, or a sign, or anything that uses writing. It’s again, pretty simple. 

>>> import turtle as t
>>> t.color('orange')
>>> font=("Verdana", 15, 'normal', 'bold', 'italic', 'underline')
>>> t.write('ManyProgramming Blog')

Now there will be a piece of writing on the Turtle Graphics saying ManyProgramming Blog. It will be in orange because I told Python BEFORE to make it orange and it will be bolg, italic and underlined. You can also change the font. The default font is Arial but I changed it to Verdana. Yet again, if you have any concerns about fonts or anything else just contact me.

If you were to insert this into a piece of quiz, then you could have pictures on your python quiz. However, I don’t think you are able to use Turtle Graphics in most Python Frameworks when making a website so we might have to go over another one.

Thank you for reading my blog and I really hope it made your day. If you have any worries, for the last time, Contact me at: programmingmany@gmail.com. Also, get ready for my Christmas blog because it’s coming out on the 24th December at 7:00pm.If you would like to see my book reviews blog than Click Here!

HOW TO MAKE A MULTIPLE-CHOICE PROGRAM

Hello, my name is Manuel and I run ManyProgramming™. Today we will be making a functional Multiple-Choice program. I will be making a quiz with five Multiple-Choice questions. At the end it will show me my score.

Today I will be showing you pretty complex and diverse multiple-choice quiz that has a lot of different features. I will try to split the quiz up into small diverse parts which we can then put completely together at the end. I will also put up a copy of the completed quiz! WARNING! WHEN I USE THE ‘#’ THAT MEANS THAT PYTHON ONLY TAKES IT IN AS TEXT AND DOESN’T PROCESS IT!

Firstly, we’ll start off with the beginning part. 

print ('WELCOME TO THE MULTIPLE CHOICE TEST\n')

name = input('WHAT IS YOUR NAME? ')

print ('\nHI THERE ' + name + '! LET''S PLAY A GAME!\n')

print ('\n-----------------------------------------------------------\n')

score = 0

First it will say ‘WELCOME TO THE MULTIPLE CHOICE TEST’, then, it will ask you for your name. Then after you put your name in it will say ‘HI THERE What_ever_your_name_is! LET’S PLAY A GAME! It will then have a line that splits the welcoming & the actual questions.

Secondly, we will do the questions.

print ('QUESTION 1: WHAT IS THE LARGEST OCEAN IN THE WORLD?\n')
print ('A. The Indian Ocean')
print ('B. The Pacific Ocean')
print ('C. The Atlantic Ocean')
print ('')

Q1answer = "B"
Q1response= input('Your answer : ')

if (Q1response != Q1answer):
print ('Sorry, that is incorrect! The answer was B')
else:
print ('Well done! ' + Q1response + ' is correct!')
score = score + 1
print ('Your current score is ' + str(score) + ' out of 5')
print ('\n-----------------------------------------------------------\n')

Now this is the question. The question will have three options as answers. You have to type the letter that you think is the correct answer; if you get the answer right, then it will say ‘Well done! Whatever_letter_you_said_correctly is correct!’but, if you get it wrong, then it will say that it is incorrect and will tell you the right answer. If you want to have multiple questions, then you just copy everything I wrote above multiple times and just edit the questions and answers. At the end the score will be +1 every time you get the answer correct! And, at the very end, it will tell you your current score and then put a line, separating the different questions!

Lastly, the part at the end is probably the easiest to understand. What you see below tells Python that it needs to print the score you got, in my case out of five because I have 5 questions, but you can decide out of how much your score should be. At the bottom, it has a line which says that the quiz is ended (Not to Python because it doesn’t take that in but to you).

print ('Your total score is ' + str(score) + ' out of 5')
print ('\n-----------------------------------------------------------\n')

# Thank you for taking part in my Quiz!! 

Now if you put all this together, then you will have a very long program and as a programmer, you want to save as much space as you can so I will now show you how to shorten everything. It will be the same, basic principal as the program we did last blog; as you’ll see below.

def question1(Quest, Ans1, Ans2, Ans3, Ans):
    global score
    correct_answer=False
    for counter in range (3):
        x=input(Quest)
        if x.upper()==Ans.upper():
            print('Well Done, You got it Correct, +1 Point')
            score+=1
            correct_answer=True
            break
        else:
            print('Sorry, You got it Incorrect, Better luck Next Time! ')
    if not correct_answer:
        print('The Answer was',Ans)

print('ManyProgramming_Quizquam','\nPlease type in the letter of your selected choice!')
score=0
question1('What is the largest Animal on Earth?','\nA= Blue Whale','\nB= Elephant','\nC= Humpback Whale,' A')
question1('What is the fastest car on Earth?','\nA= Muscle Cars','\nB= Ferrari','\nC= Koenigsegg',' C')
question1('What is the most Deadly Spider on Earth?','\nA= Tarantula','\nB= Black Widow Spider','\nC= Daddy Long Legs',' B')
print('\n-----------------------------------------------------------------)
print('\nCongratulations, Your Total Score was', score)

This way you can add as many questions as you would like by simply adding a line that tells the information of the question, as I have done above. The idea is very simple; it uses a function which determines whether the answer is right of wrong. I also have written all the different objects and used ‘\n’ to tell Python that the three options for the multiple-choice test will be on separate lines. It is also the same principal as the first program I made; if you didn’t read it then Click Here to Open the Blog!!

Thank you for reading my blog. I hope you have a wonderful day. If you want to have the quiz, email programmingmany@gmail.com and I will send you the quiz and how to load it. Also, get ready for my Christmas blog. I will post at 7:00pm on Monday the 24th of December! If you would like to see my book reviews blog then Click Here!

INTRODUCTION TO MANY-PROGRAMMING & PYTHON!

Good Morning. My name is Manuel and I run ManyProgramming™. This is my first blog. I have designed my Blogs to be different projects on Python. First I want to start to create a website to help learning different subjects. Later I plan to build robots, and other things that are fun. I will describe it in a series of blogs posted every Friday. This will break my big projects into small diverse parts. Please ask me any questions if my descriptions are not clear to youI am learning too while writing about it!

Firstly, if you have Python than you can skip this paragraph but if you don’t have Python or you are not sure than you can download it for free at https://www.python.org/downloads/. There are three main operating systems which you can get Python on: Linux, Windows and the Apple systems. If you have Linux, then you probably have Python but check if you have it. You should go to start menu to check if you have Python. If you have Windows than you should ask Cortana (Windows’ AI help assistant). If you have an Apple laptop that you can ask Siri (Apple’s AI help assistant). If after your check you do not have it, I know I repeated it, then go to https://www.python.org/downloads/. It doesn’t matter much which version of Python you install; I am using Python version 3.6 currently but 2.7 still works. 

 You can either type Python onto a command prompt or you can open IDLE. At the moment I am using IDLE because I find it much simpler to set up and command prompt is much older. Additionally you would need to have a text editor. It can be very simple if you want. I am using notepad in Windows at the moment but I am planning to try others in the future.

What is Python: Python is one of the most popular programming languages because it very simple to learn but on the other hand very powerful and flexible. What I like is that I can type in the commands and just test if it works.

Next week I will be writing about Integers, Strings and Floating Numbers. The following week I will be writing about Functions. The week after that I will be writing about Lists and Dictionaries. And then I will put everything together into a little program. After I have the program together I will try to put it into a webpage.

ManyProgramming aims to help this generation improve their life quality instead of just spending money and time on fortnite for their whole lives. We aim to bring people into the arts of engineering because as AI comes, so should our programming skills. Soon robots could even be doctors!

I got all my information from Python Website. It is free to use and if you need any further information contact programmingmany@gmail.com! Thank you for joining me on my first blog and I hope you enjoy your day. If you want to see my book reviews blog than Click Here!