Understand programming for beginners

    abhi

    0/5 stars (0 votes)

    Understand programming for beginners

    This is a special post hope you understand this. Before you write code, fill in these blanks Understand programming for beginners.

    Example used for python class but applies to all for solving the problem. For my classes. We had to turn in all all 4 steps when we turned in our program.

    # Deb
    # Chapter 2 Programming exercies p 105
    # CtoFtempConverter.py #10

    # pseudocode: Write a program that
    # asks the user how many cookies
    # he or she wants to make then displays
    # the number of cups of each ingredient
    # needed for the specified number of cookies
    # 48 cookies = 1.5c sugar, 1c butter, 2.75c flour

    # Step 2 write own what I did
    # Ask how many cookies need to be made
    # sugar = 1.5/48 how many cups of sugar per cookie
    # butter = 1/48 how many cups of butter per cookie
    # flour = 2.75/48 how many cups of flour per cookie
    # cookie = sugar + butter + flour

    # Step 3 generalize my steps
    # Set the constants
    # ask how many cookies are to be made
    # multiple cookiesToBeMade by cookie
    # print “Number of cookies requires x sugar, y butter, z flour

    # Step 4 test my algorithm and add comments

    SUGAR = float(1.5 / 48) # calculates how many cups of sugar per cookie
    BUTTER = float(1 / 48) # calculates how many cups of butter per cookie
    FLOUR = float(2.75 / 48) # calculates how many cups of flour per cookie
    recipeMain = SUGAR + BUTTER + FLOUR

    cookieCount = int(input(‘Enter the number of cookies desired: ‘))
    sugar = SUGAR * cookieCount
    butter = BUTTER * cookieCount
    flour = FLOUR * cookieCount
    recipeNew = recipeMain * cookieCount
    print(‘To make ‘,
    (format(cookieCount, ‘,.0f’)), ‘ cookies, you will need:\n’,\
    (format(sugar, ‘2,.2f’)),’c sugar\n’,\
    (format(butter, ‘2,.2f’)),’c butter\n’,\
    (format(flour, ‘2,.2f’)),’c flour’, sep=”)

    # RUBRIC CHECK
    # Requirements for all programs in assignment –
    # Pseudocode accuracy and completeness –
    # Uses descriptive variable names –
    # Includes at least two other comments –
    # Includes all necessary processing –
    # Displays output in required format –
    # Meets all program requirements –
    # Uses good grammar and spelling –
    # Includes collaboration statement: I consulted my textbook,
    # Gaddis, T. (2018). Starting out with Python® (4th ed.). Boston: Pearson

     

    Hope you like this Understand programming for beginners

    Notice

    Commenting only available for logged in users