Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

Exam #1 Write a program for a library: – We check in a customer named John Smith

Computer Science Jul 15, 2023

Exam #1

  1. Write a program for a library:
    – We check in a customer named John Smith. He’s 18 years old and is a new member of the library:
    A. Define three variables here
    –    a. name
    –    b. age
    –    c. “New” or “Existing” member

B. Print out all the variables

 

  1. course = ‘Intro to Python’
    – print(course[0:3])
    – print(course[0:])
    – print(course[:5])

– print(course[-1])
– another=course[:]
– print(another)

 

  1. Write a program that calculates the percentage of fat calories in food given the calories and fat grams. Details about the formulas and correct results appear in the comments area at the top of the program

The comments show what you should see as output when everything is debugged:

This program demonstrates a solution to the Fat Gram Calculator programming challenge.

      fatCalories = fatGrams * 9

      fatPercentage = fatCalories / calories

When debugged, calories of 100 and fat grams of 10 should display percentage of calories from fat is 90.0%

int calories = 0.0        # Number of calories

int fat_grams = 0.0        # Number of fat grams

int fat_calories = 0.0     # Calories from fat

float fat_percentage = 0.0    Percentage of fat calories

 

#Get the number of calories.

print("How many calories does the food have? ")"

calories = input()

     

#Get the number of fat grams.

fat_grams = ("How many fat grams does the food have? ");

 

#calculate the fatCalorie

fat_grams = fat_calories * 9

     

#Calculate percentage of calories from fat.

fat_percentage = fatCalories / fatGrams;

     

#display the results

print("The percentage of calories from fat is %i%" fat_percentage * 100) + "%.)

 

Submit the debugged DebuggedFatGrams.py file in Canvas under the Exam #1 link.  You need to include the screenshot showing the Python file and correct testing results.

 

Expert Solution

For detailed step-by-step solution, place custom order now.
Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment