PYTHON PROGRAMMING AND CRAFT.

                     PYTHON AND CRAFTS

                  Sub-topic:  We'll learn about python and look at my crafts.

                  The link is below.                 


 

Hi guys this is Benny’s Blog, I’m going to tell you about Python and How to make my katana (out of paper).

 

Python is a programming language and an IDE (Integrated Development Environment) used to create apps (applications).

 

An IDE is a software application that helps Programmers to develop code well/effectively.

Examples are C++, visual studio, Python, C+, C# and etc.

(Guys I don’t fully know everything about Python, but I'll try to explain what I know about Python).

  We’ll jump into the code (we will start the coding).

The print command, print (“I love Python”).

What the print command does is what you type in the speech marks, it will print what you typed in the speech marks.

How to save a file on Python

1.       Go to Save as in the file tab in the Python shell command or go to new file and click on save as (only if there is some code in your file).

2.       Save it at a suitable place for you(optional) on your computer/laptop.

 

How to recover saved files on Python

 

1.       Go To the file tab in Python shell command and click on recent files and click on the file of your choice.

 

Shortcuts in Python

Ctrl+S is used to save files.

F5 is used run module (in Script mode).

Ctrl+N is used to do a new file.

Ctrl + V and Ctrl + C is used to do copy and paste.

Ctrl + Z is used to undo a command.

 

Programming words

Parenthesis- Brackets ( ).

Quotation- speech marks’’.

 

How to run a file in Python

1.       Go to the file tab in Python shell command.

2.       Click on new file (then write your code)

3.       Save as (whatever you want to call it and save it at a suitable location).

4.       Then click on the Run Module tab and click on run.

5.       Then go back to the Python shell command.

6.       You will see the output of the code you written.

 

FF (Fun Fact):

You can write Python programming on any IDE (integrated Development Environment). First, you write your Python code on any IDE and save it with the extension .py.

 

 

Escape characters in Python

What are Escape characters?

Escape characters are special characters that allows to give the computer a heads up when we are going to pass some tricky information to it, or an escape character is a backslash \ followed by the character you want to insert.

 

\’ this is backslash single quote

e.g., print (“I love python ‘so\’ much”)

 

\” this is backslash double quote

e.g., print (“I “\code\” in python”)

 

\n this backslash n it’s used so that the text will go to the next line.

 

Variables in Python

 

Variables are containers that store some information in them or a way to track information.

 

Name=” real name”

= sign means the variable is being assigned a value or text.

Single quote means the variable is defined.

 

Using a variable in a print statement

  

Print(name)

Note: that only use this command once the variable is defined.

 

Types of Variables

 

String: it is a type of variable that has a collection of characters used to create text.

Characters: They are numbers, symbols, and words on the keyboard and in ICT.

 

Integer: It is a type of variable that uses positive/negative whole numbers instead

of string.

 

Boolean: It is a type of variable that uses True (1)/False (0) statements.

The true/false statements are logical expressions.

 

A logical operator is an operator (Not arithmetic operator) that does a condition you give it.

 

Types of logical operator

And- is a type of logical operator that runs two conditions if they are true.

Or- is a type of logical operator that runs two conditions or one condition if it is/ if they are true.

 Not- is a type of logical operator that runs one condition but the opposite of the condition.

E.G True=False or False=True.

 

Type command.

type (Any variable can be typed in the brackets so make sure it’s the variable is defined) Or type (“Any variable can be typed in the brackets so make sure it’s the variable is defined”).

 

The Type command tells you what type of variable it is.

 

Classes of Variables

Int=Integer.

Str= String.

Bool=Boolean.

 

Rules for variables in python

1.     Do not start with a number.

2.     Follow same styling (how you write you words).

3.     Be descriptive (use a specific name for your variable).

4.     Cannot have spaces (there shouldn’t be spaces in between the variable).

 

 

F-strings

What is F-strings?

It’s something that allows us to print formatted strings.

They are like normal strings but set up in a specific way or pattern.

 

Example: print (“I’m happy to code in python”)

Formatted way: 1. Create a variable(optional)=Synonym

2.     Type what you want to type (after the = sign)

3.     Then rewrite the string again but this time add f in the beginning of the string (where the speech marks begin).

4.     Replace the word you want to replace with the variable in flower brackets and you’re done.

5.     Your code should look like this: print (“I’m happy to code in python”)

Formatted way: Synonym=’Excited’

print (f“I’m {Synonym} to code in python”)

 

Dealing with more variables

A=8

B=’Hello’

C=True

 

print(type(A)

print(type(B)

print(type(C)

 

How to combine Variables in python

Firstname=’Benaiah’

Middlename=’Asare’

Surname=’Amoah’

Fullname=Firstname + Middlename +Surname

 

You use the + sign to combine variables.

To see the result do print (Fullname)

 

More variables

Name = input (“what is your name?:”’)

What this command does is that you first give it a variable, the input means you can write any input (it takes your input) and the colon (:) means that it(you can type anything).

Basically, it means that it will ask you a question and you give an input.

 

print (“Your name is”, Name)

What this command does is that the print command is printing a string (about what your name is) and the comma (,) is to separate the string and the variable because the string might think the variable is about of it (the string).

 

Steps on how to make my katana (out of paper)

A katana is a Japanese sword (like in Anime).

 

The materials you need is as the following:

Paper

Paper glue

Sellotape

Cardboard tissue rolls.

Marker.

 

Instructions to make my katana (out of paper)

1.     Get some paper glue and paper.

2.     Put the glue on the paper and stick it on another paper (multiple times until it is thick).

3.     Fold it either to the left or right.

4.     Get Sellotape and hold the thick sheet of paper and wrap the Sellotape on the thick sheet of paper.

5.     Get more paper, and one cardboard tissue roll make your katana handle (the bottom of the katana).

 

6.     Then fold the edge of the katana or cut the edge with some scissors (the top of the katana) to make the blade.

7.     And use the marker to write your name on the katana.

 

Here are my katanas.












I will also show you, my mask, boomerang, and chest plate (Armour vest).












































Here is me with the full set.











Thank you guys and have a great week ahead and leave me a comment.



It took me three days to make this post.
I hope you all will love this post.

FF(Fun Fact):
Python is case-sensitive(Small letters are important).




















Comments

Post a Comment

Popular posts from this blog

More Python programming

One week in space on the ISS...