1. # Now write a JES function named adjustRedPercent(picture,adjustmentPercentag
ID: 3887674 • Letter: 1
Question
1.
# Now write a JES function named adjustRedPercent(picture,adjustmentPercentage)
# which takes in the adjustment value as a percentage. E.g. when the
# value in adjustmentPercentage is 70, the function should make the
# image's red values 70% of their original values. If the adjustmentPercentage
# is 140, it should make the image's red values 140% of their original
# value.
# Hint: There is no need for if-statements.
# Note: Assume that adjustmentPercentage will only be 0 or greater.
# There is no need to perform error-checking.
# Note 2: You can create a corresponding driver in the space below as well.
-------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
2.
# Write a driver program that can call these 2 functions and include the 2 functions
# as well in your final answer.
------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
3.
------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------
Each of the following is equivalent to the increase red function-Program 10 (page 61). Test them and convince yourself that they work. Which do you prefer and why? def increaseRed2 Cpicture) for p in getPixelsCpicture): setRed (p,getRed (p)*1.2) def increaseRed3 Cpicture): for p in getPixels (picture): ent getRed (p) redCompon greenComponent getCreen(p) blueComponent-getBlue (p) newRed-int (redComponent*1.2) newColor-makeColor (newRed.greenComponent,blueComponent) setColor (p, newColor)Explanation / Answer
The very first time I started to learn programming I did so in PHP or C++. I'm not very sure which one it was. But there are few reasons why I feel Python is a better choice.
First of all Python has a rather simple yet effective syntax. Python forces you to write "cleaner code" through forced indentation and I feel this experience pays off when learning other languages. Take another very important concept in programming like types. Javascript treats variable types implicitly which I find very confusing for new programmers. The same way C and C++ overcomplicate types and have the programmer fight through it without really knowing why and when they should use one type instead of another.
There are many other factors that make Python an ideal language for beginners. It uses many of the most important programming concepts like object oriented programming, multi threading, scheduling, functional programming, bitwise operations, ecc.
To add to this, which I find extremely important to beginners, Python is widely supported by an immense number of modules and extensions. Python fits perfectly for pretty much any kind of possible use. While it is obviously not the perfect tool for every use, it's always okay enough to make any kind of program, even 3d games (which are often a huge appeal to beginners). Even in game making Python is a very useful tool. Python is the de facto scripting language of industry leading tools such as Autodesk Maya and the most important game engines such as Unreal Engine have Python wrappers allowing you to focus on making first and optimizing later as you gain more experience with C++.
I don't think that even Javascript fits the general go-to programming languea as well as Python does. Somebody with a grasp of C will have a hard time writing a dynamic website easily, somebody into Javascript may find it hard to use his knowledge into other stuff (plus JS feels somewhat impredictable during runtime, something I have never, ever, felt in Python).
Next, Python's very diffused in the programming community. It often sits at the top of questions and answers on stackoverflow, this is very important as beginners have often plenty of questions ranging from beginner to complex subjects. This implies that a large number of this questions has plenty of answers.
If you're looking on how to make an online quiz app with Python, you will probably find plenty of repositories on github. You want to make a reddit bot? You want to create a program that tracks the price of AMD's GPU RX 580 because you're tired refreshing your browser and looking at the stores manually? You will probably find hundreds of scrapers and alert bots and truth to be told they are often easier to understand than equivalent scripts or programs in other languages (that's at least my opinion).
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.