Python Coding Program On Trinket

Below is the Powerpoint

Python Programming

Python is a programming language software that is used to create scripted language in numerous application from fundamental scripts to constructing websites and network security. Python is also used to make pixelated games such as Pac Man. Many computer programs also use Python programming, such as our mini computer Raspberry Pi. Further, Python is one of the simplest, self-explanatory forms of coding that you can do on a Trinket, which lets you write and run codes in any browser. In all, Python is versatile, easy to learn and uses minimal lines of codes, and free and open sources.

Our project is combining three different Python program codes into our own storyline gameplay on Trinket. We first look into the various Trinket programs from an introductory Python Trinket guide and combined some parts to make our own storyline of two turtle friends making a picture together.  The three trinkets we used from the Introductory Python Coding trinkets are called, “Tina and Tommy Colors”, “A picture with Tina and Tommy”, “Going in Circles”. Our group was very interested in Python Programming and wanted to do more than just the Python Turtle Race lab done in class. Especially since Python Programming is the basics of pixel games, however, creating a whole game would be too complex so we decided to try something else like a drawing.

The most complicated part was the debugging process. Each Python Program did have a code guide but that introductory Python Trinket guide was pretty old, so some commands have changed over time and we had to figure that out. We also had many other debugging processes. Such as the command, turtle.Turtle() did not run because it was outdated and instead we used just Turtle(). Import turtle is also an outdated command, so we must use the command “from turtle import *”. Combining three different Trinket codings into one was difficult because it did not combine in “Run” mode rather it only worked in “Console” mode. At first “Console” mode did not void the first Trinket codings because we forgot to void using the hashtag(#). Combining the third trinket with our other two trinkets was the most complicated. The Third Trinket, when we ran the codes at first there were no colors but then we added the code: nghi.color(‘magenta’) to give the sketches some color. The original codes of the third Trinket of “A Visual Introduction to Python” was not what we wanted so we changed some of the codes. For instances, the shape of the eyeballs was uneven with one eyeball being smaller than the other, and we wanted even eyeballs so we had to figure out which part of the code is which circle and changed the numbers around constantly. We couldn’t figure out how to integrate our turtles in creating one image together. For our third Python coding, we wanted one turtle to create the outline of the pictures and the other to fill in the colors. However, it did not work as we wanted to on the first try, we had to constantly add and remove codes to make it work. We added the write command codes to our turtles to let the audience see the conversation between the turtles so they’ll know which turtle is going to do what and understand the picture a bit better.

Coding Process 

https://trinket.io/python/75b5e3cdca?runMode=console

from turtle import * (Is to start the program)

nghi = Turtle()

nghi.shape(‘turtle’) (Shape of turtle)

nghi.color(‘magenta’) (Color of turtle)

nghi.left(90) (Direction and axis distance)

nghi.forward(100) (Direction and axis distance)

nghi.write(“Hi! I’m Nghi :D”) (The turtle will write, basically it’s own speech bubble)

nghi.forward(20) (Direction and axis distance)

nghi.right(90) (Direction and axis distance)

nina = Turtle()

nina.shape(‘turtle’)

nina.color(‘purple’)

nina.right(90)

nina.forward(100)

nina.write(“Hai! I’m Nina!”)

nina.forward(20)

nina.left(90)

#————————— (# to void)

#nghi = Turtle()

#nghi.shape(‘turtle’)

#nghi.color(‘magenta’)

#nghi.left(90)

#nghi.forward(100)

#nghi.write(“Hi! I’m Nghi :D”)

#nghi.forward(20)

#nghi.right(90)

 

#nina = Turtle()

#nina.shape(‘turtle’)

#nina.color(‘purple’)

#nina.right(90)

#nina.forward(100)

#nina.write(“Hai! I’m Nina!”)

#nina.forward(20)

#nina.left(90)

#————————-

from turtle import *

nghi = Turtle()

nina = Turtle() (Putting in a turtle)

nghi.color(‘magenta’) (Color of turtle)

nina.color(‘purple’)

 

nghi.shape(‘turtle’)

nina.shape(‘turtle’)

 

nghi.begin_fill() (Basically it will fill the box drawn with a color)

nghi.goto(200,0) (An axis point for the turtle to go to)

nghi.goto(200,-200) (An axis point for the turtle to go to)

nghi.goto(-200,-200) (An axis point for the turtle to go to)

nghi.goto(-200,0) (An axis point for the turtle to go to)

nghi.goto(0,0) (An axis point for the turtle to go to)

nghi.end_fill() (To stop the filling)

nina.penup() (Raises a ‘pen’)

nina.goto(-70,100) (An axis point for the turtle to go to to start)

nina.write(“Nghi!! Let’s Make a picture together!”) (Speech)

nina.goto(0,50) (An axis point for the turtle to go to to start)

nina.pendown() (Putting the ‘pen’ down to start making something)

nghi.penup() (Raises pen to stop drawing)

nghi.color(‘white’) (Color of Nghi in her Magenta box)

nghi.goto(-40,-100)

nghi.write(“Alright, I’m ready!!”)

nghi.goto(0,-130)

nghi.pendown()

#————————– (# to void)

#nghi = Turtle()

#nina = Turtle()

#nghi.color(‘magenta’)

#nina.color(‘purple’)

#nghi.shape(‘turtle’)

#nina.shape(‘turtle’)

#nghi.begin_fill()

#nghi.goto(200,0)

#nghi.goto(200,-200)

#nghi.goto(-200,-200)

#nghi.goto(-200,0)

#nghi.goto(0,0)

#nghi.end_fill()

#nina.penup()

#nina.goto(-70,100)

#nina.write(“Nghi!! Let’s Make a picture together!”)

#nina.goto(0,50)

#nina.pendown()

#nghi.penup()

#nghi.color(‘white’)

#nghi.goto(-40,-100)

#nghi.write(“Alright, I’m ready!!”)

#nghi.goto(0,-130)

#nghi.pendown()

#————————– (# to void)

from turtle import *

nghi = Turtle()

nghi.shape(‘turtle’)

nghi.color(‘magenta’)

nina = Turtle()

nina.shape(‘turtle’)

nina.color(‘purple’)

 

nghi.write(“I’ll sketch it!”) (Speech)

nghi.penup() (Starting to draw)

nghi.goto(30,-150) (Moves to a certain axis)

nghi.pendown() (Starts drawing)

nghi.circle(130) (Make a circle with a diameter of 130)

nghi.penup() (Finished drawing)

nghi.goto(0,0) (An axis point for the turtle to go to)

nghi.pendown() (Pen back down to draw)

nghi.circle(30) (Make a circle with a diameter of 30)

nghi.circle(20) (Make a circle with a diameter of 20)

nghi.penup()

nghi.forward(60) (Moving 60 over)

nghi.right(45) (Moving 45 right)

nghi.pendown() (Draws again)

nghi.circle(30) (Another circle with a diameter of 30)

nghi.circle(20) (Another circle with a diameter of 20)

nghi.penup()

nghi.right(90) (Moving right by 90)

nghi.forward(90)

nghi.pendown()

nghi.circle(40) (Big circle of a 40 diameter)

nghi.penup()

nghi.goto(25,-25)

from turtle import *

nina = Turtle()

nina.shape(‘turtle’)

nina.color(‘purple’)

nghi = Turtle()

nghi.shape(‘turtle’)

nghi.color(‘magenta’)

 

nina.write(“I’ll color it!”) (Speech)

nina.penup()

nina.begin_fill() (Filling in the circle)

nina.color(‘pink’) (Circle is filled with the color of pink)

nina.goto(30,-150)  (An axis point for the turtle to go to)

nina.pendown()

nina.circle(130)

nina.penup()

nina.end_fill() (Stop filling)

nina.color(‘white’) (Changing color to change the color I’m about to fill)

nina.goto(0,0)

nina.begin_fill() (Filling in a space with color again)

nina.pendown()

nina.circle(30)

nina.penup()

nina.end_fill() (Stop filling)

nina.begin_fill()

nina.color(‘black’)

nina.pendown()

nina.circle(20)

nina.penup()

nina.end_fill()

nina.forward(60)

nina.right(45)

nina.begin_fill()

nina.color(‘white’)

nina.pendown()

nina.circle(30)

nina.penup()

nina.end_fill()

nina.begin_fill()

nina.color(‘black’)

nina.pendown()

nina.circle(20)

nina.penup()

nina.end_fill()

nina.right(90)

nina.forward(90)

nina.begin_fill()

nina.color(‘purple’)

nina.pendown()

nina.circle(40)

nina.penup()

nina.end_fill()

nina.goto(25,-25)

nina.color(‘purple’)

Information Literacy

A Visual Introduction to Python. (n.d.). Retrieved from https://hourofpython.trinket.io/a-visual-introduction-to-python#/welcome/an-hour-of-code

A Visual Introduction to Python. (n.d.). Retrieved from https://hourofpython.trinket.io/a-visual-introduction-to-python#/multiple-turtles/tina-and-tommy-s-colors

A Visual Introduction to Python. (n.d.). Retrieved from https://hourofpython.trinket.io/a-visual-introduction-to-python#/put-it-all-together/a-picture-with-tina-and-tommy

A Visual Introduction to Python. (n.d.). Retrieved from https://hourofpython.trinket.io/a-visual-introduction-to-python#/turtles/going-in-circles

Welcome to Python.org. (n.d.). Retrieved from https://www.python.org/

What is Python? (n.d.). Retrieved from https://www.pythonforbeginners.com/learn-python/what-is-python/

WHY LEARN PYTHON? (n.d.). Retrieved from https://www.codingdojo.com/what-is-python-programming

 

 

 

Python Turtle Race

View the Turtle Race Below

https://trinket.io/python/87fff33d89

Coding Process
#!/bin/python3
from turtle import *
# forward(100)
# write(0)
# forward(100)
# write(5)
#———-
# write(0)
# forward(20)
# write(1)
# forward(20)
# write(2)
# forward(20)
# write(3)
# forward(20)
# write(4)
# forward(20)
# write(5)
# forward(20)
#————-
# for step in range(6):
# write(step)
# forward(20)

#————-
#from turtle import *
#goto(-140, 140)
#for step in range(6):
#write(step)
#forward(20)
#—————
#penup()
#goto(-140, 140)
#for step in range(6):
#write(step)
#forward(20)
#—————
# for step in range(6):
# write(step, align=’center’)
# right(90)
# forward(10)
# pendown()
# forward(150)
# penup()
# backward(160)
# left(90)
# forward(20)
#—————
from turtle import *
speed(10)
penup()
goto(-140, 140)
#—————

for step in range(15):
write(step, align=’center’)
right(90)
for num in range(8):
penup()
forward(10)
pendown()
forward(10)
penup()
backward(160)
left(90)
forward(20)

#—————-

Nghi = Turtle()
Nghi.color(‘blue’)
Nghi.shape(‘turtle’)
Nghi.penup()
Nghi.goto(-160, 100)
Nghi.pendown()

#—————
from turtle import *
from random import randint
#—————-

Nina = Turtle()
Nina.color(‘purple’)
Nina.shape(‘turtle’)
Nina.penup()
Nina.goto(-160,70)
Nina.pendown()
#——————
Kim = Turtle()
Kim.color(‘pink’)
Kim.shape(‘turtle’)
Kim.penup()
Kim.goto(-160,40)
Kim.pendown()
#—————-

Bob = Turtle()
Bob.color(‘red’)
Bob.shape(‘turtle’)
Bob.penup()
Bob.goto(-160,10)
Bob.pendown()
#—————

for turn in range(10):
Nghi.right(36)
Nina.right(36)
Kim.right(36)
Bob.right(36)

#—————–
for turn in range(100):
Nghi.forward(randint(1,5))
Nina.forward(randint(1,5))
Kim.forward(randint(1,5))
Bob.forward(randint(1,5))

E-Waste Recycling Center

 

`            The major thing I learned from the PBS NewsHour video and the Computer Recycling Center at Temple University is the meaning of E-waste recycling. Before this, I was clueless and did not know that electronic waste exists. I never put much consideration into the afterlife of electronics after individuals are finished with it. In my household, most of our electronics are still in the same spot as it was when we first bought it. While smaller electronics like cellphones and laptops are stored in our closets or was given away to our relatives. Regarding this, I was surprised that it is considered illegal to dispose of electronics in the trash since it is hazardous with toxic materials and chemicals. In the PBS NewsHour video, goes into the afterlife of electronics that is recycled in the US. It turns out that rather than electronics waste being dumped at US recyclers and being processed there, it is exported and transferred over to other countries (2016). In this case, the Watchdog group put tracking devices on various electronics and dropped it off at different recyclers center. Some of the electronics they found ended up in China. Regarding this, they went undercover to China to see exactly where the e-waste recyclers center/junkyards are located and the processing of the electronics. It occurs that the workers are oblivious to the danger and toxic that is in the electronics. Recyclers companies export electronics to other countries to reduce cost due to the decrease of sell (Christensen & Campell 2016). Further, one thing that I believed is important from being at the CRC at Temple, is the statement “Reduce what you buy, reuse what you have, and recycle,” I think this summarize on how people perspective should be when they are purchasing materials goods.

`The Computer Recycling Center at Temple University services is incredible. The CRC collects excessive and old electronic equipment and computers at the University, and they refurbish, reutilize, donate, or disposes of it safely. The services they are offering is adequate because there are numerous of electronics at the campus and in the neighborhood that are just sitting there or being misplaced. With this service, it allows all the old and excessive computer and electronic equipment to be in one place and being processed by professional. The recycling center is not well known and well used by the community. Personally, I never heard of the recycling center until our visit there. Also, I never heard of any mentions of the center and services from anyone or see any ads around the school regarding it. Further, I think a great start for people to know about this great service would be having a universal email sent out about the center and the services it offers. I think another way would be having different ads and posters displayed throughout the campus and on social media so everyone can be aware of. With the publicity, more people will know where to drop off their old or unused computer and electronic equipment, so it doesn’t end up in the garbage, or just sitting in their room being untouched.

Christensen, K & Campbell, K. [NewsHour, PBS]. (2016, May 9). Watchdog group tracks what really happens to your ‘recycled’ e-waste [Video file]. Retrieved from https://youtu.be/3sUT1u4WMP4

Temple University. (n.d.). Retrieved from https://its.temple.edu/lab/computer-recycling-center

 

Internet: IP (Internet protocol) & TCP (Transmission control protocol

If you’re looking for a quick and interesting video on internet protocol (IP) and transmission control protocol (TCP), the video link below discusses IP and TCP, and how it permits the Internet to run as it does. The short videos navigate through IP and TCP in our network settings through the host talking and incorporating illustrations and every-day concept/ things to make the video much easier to understand to individuals that are not a techie. The host first mentioned about how videos online don’t process the same as connections and broadcast on television. Online videos on the internet are traffic and have to be conveyed to the correct place and know the location it is going. Regarding that, IP AND TCP protocols appear to navigate the data. The host then made a reference that IP/TCP is similar to cakes and sandwiches, that the way IP/TCP is made up of many different levels of computer codes. The first level being the application, this is where programs like web browser interchange with protocols like HTTP and SMTP. The following layer is TCP, where data from programs being use goes through a port that can allot with protocols in the application so that TCP knows where it came from. Furthermost part, most web browser goes through HTTP. The TCP is then compact in packets where it then all individually take the fastest course over the internet to wherever it is going. Not to mention, TCP also sends instructions along to reconstruct the packets so that nothing went wrong during the transfer. Once this is all situated, the packets are then moved into IP, to connect the origin and destination IP address. Not to mention, packet switching makes the internet process much faster than normal. This is because data are sorted and send individually to avoid any blockage during the route.

 

Network: Bandwidth

If you’re looking for a webpage on bandwidth. The link provided below is a substantial and simple webpage that elaborate on the meaning of bandwidth and how much bandwidth does a business need. The webpage is easy to navigate through with numerous sections that all interconnects to bandwidth. Each of the sections is portions and thoroughly detailed to make understanding bandwidth must more effortless, with texts and pictures. For instance, the webpage first mentioned the general concept of bandwidth. Bandwidth explains the various level of traffic, and the amount of data that can transfers links between the user, site, and the Internet. Further, how web hosting companies have various package levels that offer the topmost level of bandwidth. Not to mention, each hosting companies abide by three key components; networks, connections, and systems. The following section discussed the basis of network connectivity. This solely means that the larger the connection, the faster the network, the additional bandwidth is obtainable for the site. Further, bandwidth at home states that the word “speed” is basically bandwidth and the bandwidth between the network and computer tend to travel at the speed of 1.5 MB. In addition, the slowness of DSL connection which is broadband represents the extent to transfer a large amount of data, (1000 megabits equal 1 gigabit). Further, within web hosting, a DSL connection can be shared through the server. Additionally, the webpage on bandwidth mentioned the relationship with web traffic. Overall, the higher the bandwidth, means the more people can manage the site at the same time efficiently.

https://www.executionists.com/an-explanation-of-bandwidth/

 

Controlling the CPU to Do Our Bidding

Ever wonder how our visions and plans in our head come to life through CPU that only can understand 0’s and 1’s? The CPU is a principal part of a computer that interconnects with other components in order for a computer to run and process efficiently. Not to mention, the relationship between the CPU and RAM is important to understand. Furthermore, within a CPU algorithm get converted down to CPU instructions in machine codes of 0’s and 1’s.

Ram is an important factor in how CPU functions. Each RAM can accommodate one instruction or number. There are combinations of data and instructions stored in the RAM. The instructions must be organized in order for the CPU and CPU cycle to understand through the RAM memory. The CPU cycle starts at fetch, which received the information from the RAM. Next, decode comes along to compute the instructions. Then, the instructions are executed then repeat at fetch. This process can extend to Machine Cycle that has three important factors the control unit, ALU, and the main memory. The Control Unit hold step 1 and 2 of fetch and decode. The ALU is step 3 in execution. Then, finally, the main memory in step 4 is where the results in memory are stored. Eventually, the Assembly Language Instructions have to be converted into Machine code so that the CPU can understand the RAM instructions. In Algorithms, there are high-level languages like Java, PHP, Python, etc. Also, assembly language is then decreased from assembler to machine code. Next, the instructions set is then transferred into the CPU. Moreover, Machine Cycle also correspond with CPU. Further, the algorithm is a digital and computer science form of a series of steps to guaranteed accurate outcomes.

Kernighan, B. W. (2017). Understanding the digital world: What you need to know about computers, the Internet, privacy, and security. Princeton: Princeton University Press.

Fetch Decode Execute Cycle in more detail

The video shows the CPU cycle about fetch, decode, and execute. Also, how the CPU plays numerous different roles like being a memory address register, the memory data register, accumulator, program counter, and an instruction register. Lastly, the video will explain discuss how machine code commands are represented through assembly language code.

 

Kernighan, Brian W. Understanding the Digital World: What You Need to Know about Computers, the Internet, Privacy, and Security. Princeton University Press, 2017.

Controlling 1s and 0s

In a computer, the binary digits of 1s and 0s are getting pushed and changed internally. Computers are electronic devices that are a part of the digital world that only understands the function s of 1s and 0’s. So why does it only understand these two specific digits? This is because there are transistors and switch that operates along with logic gates. Also, through the circuits and different combination of transistors. In addition, in Boolean algebra and Truth table where 1s and 0s are the only understanding numbers.  This all plays a role in the reason that computers only operate in two binary digits 1s and 0s.

  • Transistors – Switches
  • Circuits – Combination of Transistors
  • Boolean Algebra
  • Truth Table
  • Logic Gates

A transistor is a DC power device. Considering this, it can be utilized as an electronic switch that operates the turn On and Off mode. This interconnects with how 1s and 0s exist. It has two type of signals “high” = 1 and “low” = 0. Also, CMOS transistors construct complete outputs. The voltage at the Gate Terminal decides whether there will be an interrelation between the sources. Further, in a complementary transistor, the on and off gate voltage are opposed from one another. In the logic gates, there is two inputs but only one output which depicts the contrasting voltage levels. Moreover, a truth table is a mathematical table that is used for digital logic gates tasks and interconnects with Boolean algebra that manages binary numbers and logical values. Particularly, different logic gates have their own set of Truth Table and different Boolean algebra mathematics.

Kernighan, B. W. (2017). Understanding the digital world: What you need to know about computers, the Internet, privacy, and security. Princeton: Princeton University Press.

See How Computers Add Numbers in One Lesson

This video shows in depth and a visual of the internal of a computer to see how transistor collaborates in a microprocessor to add numbers using logic gates.

Bits, Bytes, and Representation of Information

A computer has three foundational keys on how information is depicted. The first idea is the computer is a digital processor. This means that it hoards and process information that is a separate piece that has distinct values, primarily only numbers. Moreover, the second idea is computers portray information in bits. Regarding this, the third idea is the class of bits rendered greater things like words, names, letter, and numbers.

Below are various interesting keys that regard to how information is represented.

  • Analog is the concept of value that alters efficiently and unceasingly as something else is adjust. Most of the things we do in the real world relate to the idea of analog.
  • In the Digital system, information is represented in numeric values, but in binary it is in numbers of two values. A bit is a shorten version of binary digits.
  • The powers of two and powers of ten are important in the digital world when it comes to a computer information system.
  • Bits can depict a numeric value if the digits are illuminated in the usual place value aspect, however using base 2 instead of base 10. Going past ten, more digits are used with two decimals points, 000-999.
  • ASCII is a 7-bit character set that has 128 values.

Bytes

In most present computers, the primary unit of processing and memory organization is 8 bits and is served as a unit called byte. One individual byte can encode 256 different values which could have an integer value between number 0 to 255 or an individual character in ASCII. Further, frequently byte is a part of a larger class that can represent something extensive and complicate. Not to mention, bytes can also be depicted in Unicode character. In addition, the numeric values of one or more bytes can be conveyed in decimals form. Furthermore, hexadecimal is used if the decimal form is triple in numbers. It a system of the numerical value being 16 rather than 10 as the base.

Kernighan, B. W. (2017). Understanding the digital world: What you need to know about computers, the Internet, privacy, and security. Princeton: Princeton University Press.

Where did Bytes Come From? – Computerphile

The video provides in-depth information about the source of Bytes by Professor Brailsford. It answered the questions of “Where Bytes come from “and “Why do we have 8 bits in a byte”.

What’s in a Computer?

Everyone use some sort of technology that has a computer programmed into the device so it could function and do what it is made to do. However, not many people know exactly what is in a computer. There are different components within a computer that work together to perform efficient tasks for users.

Below are various interesting key factors and components of a computer.

  • The most simple and standard computer has the following parts, a processor (CPU), display or screen, mouse, keyboard, touchpad, primary memory (RAM), and secondary storage (SSD, hard disk).
  • The processor also known as the CPU is basically the core and foundation of any technology, it is considered the brain that works to interconnect and manage the performance of other components within. As well as, pass data throughout and work on arithmetic.
  • RAM means random access memory. Ram saves and stores information that is being used while the computer is on. However, once the computer is shut off, it disappeared unless works are saved and favorite, (It is extremely important to save your work repeatedly!)

Moore’s Law

Gordan Moore issued an article entitled “Cramming more components onto integrated circuits,” Moore stated as technology advanced, transistors would double every two years while the cost decreased and likely is half of the price. Further, as the year progressed the exponential growth gain a significantly large integrated circuit that is approximately millions time more compared to the mid-1960s. Over the years, many creators believe and follow this law to guide them to design and produce preferable chips that are effective throughout the years at a low rate. However, recently there has been a decline in people following this law. It is believed that it is much tougher to generate a chip to be smaller and compact while trying to make it a reasonable price.

Kernighan, B. W. (2017). Understanding the digital world: What you need to know about computers, the Internet, privacy, and security. Princeton: Princeton University Press.

Moore’s Law Is Ending… So, What’s Next?

The video explains Moore’s Law briefly and questions that will happen next with the Moore’s Law. As well as, how scientists are in process of devising a new model that can relate to the current generation of computer. As well as, interconnect with the expansion of the digital world.