Python programming | Information Systems homework help

General information/requirements/grading rules

  1. This homework tests your knowledge of Functions. So you need to use functions to get grades.
  2. Adhere to the naming conventions discussed in class for variable names, program name and function names
  3. Use meaningful names for variables
  4. If there are two words in the variable use first word lowercase and first letter of second wordupper case i.e., firstName or underscore between 2 words i.e first_name
  5. Include appropriate comments in the code
  6. Output should be displayed exactly as mentioned against each problem
  7. Indent the lines of code appropriately
  8. primeNum.py (20 points)

Write a program that displays all of the prime numbers from 1 through 10. The program should have a loop that calls the is_prime function.

Hints:

Declare local variables under main() program

For each number, print whether or not it is prime.

           Write for loop, use range function to loop through the total numbers.

               Call is_prime function 

               print if the number is prime or not prime

        Define is_prime function, ‘def is_prime(number):’

            The is_prime function receives a number as an argument, and returns True if number is prime, False otherwise. 

Sample Output:

number      is prime
————————
1      not prime
2      prime
3      prime
4      not prime
5      prime
6      not prime
7      prime
8      not prime
9      not prime
10      not prime

  1. calories.py (25 points)

Write a program that calculates following and display Grams of fat, Fat calories, Grams of carbs, Carb calories in 2 decimal positions.

 the number of calories that result from the fat using formula:

                  Calories from fat = fat grams * 9

the number of calories that result from the carbohydrates using formula:

               Calories from carbs = carb grams * 4

Hints:

Declare local variables under main() program

Prompt the user to enter grams_fat and grams_carbs

Calculate calories from fat

Calculate calories from carbs

Define a function to display resulting calories – 

def showCarbs(gramsFat, gramsCarbs, caloriesFat, caloriesCarbs):

Note: This function will be called from main()

Sample Output:

If fat grams consumed entered is 87

If carbohydrate grams consumed entered is 39 then the output would be:

Grams of fat:  87.00

Fat calories:  783.00

Grams of carbs:  39.00

Carb calories:  156.00

  1. testscore.py (25 points)

Write a program that prompts the user to enter 5 test scores. The program should display a letter grade for each score and the average test score.

Hint:

Declare local variables under main() program

Prompts the user to enter 5 test scores

Define a function to calculate the average score: this should accept 5 test scores as argument and return the avg

Define a function to determine the letter grade: this should accept a test score as argument and return a letter grade based on the following grading scale.

Score         Letter Grades

90-100                A

80-89                   B

70-79                   C

60-69                   D

Below 60            F

Sample Output:

score                   numeric grade   letter grade

—————————————————-

score 1: 99.0                     A

score 2: 78.0                     C

score 3: 68.0                     D

score 4: 99.0                     A

score 5: 89.0                     B

—————————————————-

Average score:  86.6                     B

4. randomGuess.py (30 points)

Write a program that generates a random number in the range of 1 through 20, and asks the user to guess what the number is. 

If the user’s guess is higher than the random number, the program should display “Too high, try again”.

If the user’ guess is lower than the random number, the program should display “Too low, try again”.

If the user guesses the number, the application should congratulate the user and generate a new random number so the game can start over.

The game continues until the user chooses to quit by entering 0 as input anytime. 

Sample Output:

Enter a number between 1 and 20, or 0 to quit: 14
Too high, try again
Enter a number between 1 and 20, or 0 to quit: 5
Too low, try again
Enter a number between 1 and 20, or 0 to quit: 10
Too low, try again
Enter a number between 1 and 20, or 0 to quit: 13
Congratulations! You guessed the right number!
Enter a number between 1 and 20, or 0 to quit: 10
Too high, try again
Enter a number between 1 and 20, or 0 to quit: 5
Too low, try again
Enter a number between 1 and 20, or 0 to quit: 7
Too low, try again
Enter a number between 1 and 20, or 0 to quit: 9
Congratulations! You guessed the right number!
Enter a number between 1 and 20, or 0 to quit: 0
Thanks for playing!

Calculate the price of your order

Choose an academic level, add pages, and the paper type you want.
To reduce the cost of our essay writing services, select the lengthier deadline.
We can't believe we just said that to you.

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Why is Purdue Papers the Most Helpful Essay Writing Service for You?

  1. Custom-written and plagiarism-free papers: Our authors create their work from scratch. Before presenting them to clients, we routinely verify them for signs of plagiarism. Our quality assurance group also double-checks and fixes any grammatical errors, assuring that all of our authors adhere to the same standards of writing.
  2. The significance of timely delivery cannot be overstated, and we consistently strive to meet or exceed our clients' deadlines. Regardless of the short time frame, you can count on our writers to get the job done. We always have a team of writers ready to go, even if the deadline is only six hours away.
  3. Customer Satisfaction: Our customer service representatives are the best in the business and have a wealth of knowledge in dealing with clients. All our customer service representatives are trained to listen and reply promptly until you are satisfied with their service. To ensure you're happy, our expert writers will strictly follow the criteria to generate a special report. Our customer service may be contacted by chat, email, or phone. In addition, we provide round-the-clock assistance to all of our clients.
  4. Confidentiality: Our systems are safe, and your information is always protected. We're constantly looking for new facts when it comes to finishing your work. We use a safe and secure payment channel. Since our ordering process is completely anonymous, you don't have to provide any credit card information to place a purchase with us.
  5. Highly Trained Authors: Our writers have received extensive training and are committed to delivering only the best papers. They are fluent in APA, MLA, HARVARD, IEEE, CHICAGO, and AMA referencing styles. To meet your expectations, our skilled writers always pay close attention to your instructions.
  6. Lowered prices: We have set prices that are already discounted. Our prices are the best and affordable for all our esteemed customers.

Let Professionals Take Care of your Academic Paper