Python

Need Help in Python Assignment?
We can help you if you are having difficulty with your Python Assignment. Just email your Java Assignment at admin@assignmentcache.com.
We provide help for students all over the world in Python Assignment.

Items 1 to 10 of 11 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Ascending Direction
  1. PRG 211 Week 1 Lab 3.8 Using math functions Program

    PRG 211 Week 1 Labs

    Regular Price: $15.00

    Special Price: $12.00

    Lab 3.1 Formatted Output Hello World!


    Write a program the outputs 'Hello World!'



    Lab 3.2 Formatted output: No parking sign.


    Write a program that prints a formatted "No parking" sign. Note the first line has two leading spaces.
    NO PARKING
    1:00 - 5:00 a.m.



    Lab 3.3 House real estate summary


    Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (currentPrice * 0.045) / 12.


    Ex: If the input is 200000 210000, the output is:


    This house is $200000. The change is $-10000 since last month.
    The estimated monthly mortgage is $750.0.
    Note: Getting the precise spacing, punctuation, and newlines exactly right is a key point of this assignment. Such precision is an important part of programming.



    Lab 3.4 Caffeine levels


    A half-life is the amount of time it takes for a substance or entity to fall to half its original value. Caffeine has a half-life of about 6 hours in humans. Given caffeine amount (in mg) as input, output the caffeine level after 6, 12, and 18 hours.


    Ex: If the input is 100, the output is:


    After 6 hours: 50.0 mg
    After 12 hours: 25.0 mg
    After 18 hours: 12.5 mg
    Note: A cup of coffee has about 100 mg. A soda has about 40 mg. An "energy" drink (a misnomer) has between 100 mg and 200 mg.



    Lab 3.5 Divide by x.


    Write a program using integers userNum and x as input, and output userNum divided by x four times.


    Ex: If the input is 2000 2, the output is:


    1000 500 250 125
    Note: In Coral, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).



    Lab 3.6 Driving costs.


    Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles.


    Ex: If the input is 20.0 3.1599, the output is:


    1.57995 7.89975 63.198
    Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. First use the dollars/gallon and miles/gallon values to calculate the dollars/mile. Then use the dollars/mile value to determine the cost per 10, 50, and 400 miles.


    Note: Real per-mile cost would also include maintenance and depreciation.



    Lab 3.7 Simple statistics.


    Part 1
    Given 3 integers, output their average and their product, using integer arithmetic.


    Ex: If the input is 10 20 5, the output is:


    11 1000
    Note: Integer division discards the fraction. Hence the average of 10 20 5 is output as 11, not 11.666666666666666.


    Submit the above for grading. Your program will fail the test cases (which is expected), until you complete part 2 below but check that you are getting the correct average and product using integer division.


    Part 2
    Also output the average and product, using floating-point arithmetic.


    Ex: If the input is 10 20 5, the output is:


    11 1000
    11.666666666666666 1000.0



    Lab 3.8 Using math functions


    Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the absolute value of x, and the square root of (xy to the power of z).


    Ex: If the input is 5.0 6.5 3.2, the output is:


    34938.56214843421 1.2995143401732918e+279 5.0 262.42993783925596
    Hint: Coral has built-in math functions (discussed elsewhere) that may be used.



    Function Behavior Example
    SquareRoot(x) Square root of x SquareRoot(9.0) evaluates to 3.0.
    RaiseToPower(x, y) Raise x to power y: RaiseToPower(6.0, 2.0) evaluates to 36.0.
    AbsoluteValue(x) Absolute value of x AbsoluteValue(-99.5) evaluates to 99.5.

    Learn More
  2. PRG 211 Week 3 Lab 7.4 Countdown until matching digits Program

    PRG 211 Week 3 Labs

    Regular Price: $15.00

    Special Price: $12.00

    PRG 211 Week 3 Labs


    Lab 7.1 Loops Convert to binary


    Write a program that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is:


    As long as x is greater than 0
    Output x % 2 (remainder is either 0 or 1)
    x = x / 2
    Note: The above algorithm outputs the 0's and 1's in reverse order.


    Ex: If the input is 6, the output is:
    011
    (6 in binary is 110; the algorithm outputs the bits in reverse).



    Lab 7.2 Loops Varied amount of input data


    Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics.


    Ex: When the input is 15 20 0 5 -1, the output is:
    10 20
    You can assume that at least one non-negative integer is input.



    Lab 7.3 Loops Output range with increment of 10


    Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer.


    Ex: If the input is -15 30, the output is:
    -15 -5 5 15 25


    Ex: If the second integer is less than the first as in 20 5, the output is:
    Second integer can't be less than the first.


    For coding simplicity, output a space after every integer, including the last.



    Lab 7.4 Loops Countdown until matching digits


    Write a program that takes in an integer in the range 20-98 as input. The output is a countdown starting from the integer, and stopping when both output digits are identical.


    Ex: If the input is 93, the output is:
    93 92 91 90 89 88


    Ex: If the input is 77, the output is:
    77


    Ex: If the input is not between 20 and 98 (inclusive), the output is:
    Input must be 20-98


    For coding simplicity, follow each output number by a space, even the last one. Use a while loop. Compare the digits; do not write a large if-else for all possible same-digit numbers (11, 22, 33, ..., 88), as that approach would be cumbersome for large ranges.

    Learn More
  3. PRG 211 Week 5 Lab 11.1 Miles to track laps Program

    PRG 211 Week 5 Labs

    Regular Price: $20.00

    Special Price: $15.00

    PRG 211 Week 5 Labs


    Lab 11.1 Miles to track laps


    One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps.


    Ex: If the input is 1.5, the output is:
    6.0


    Ex: If the input is 2.2, the output is:
    8.8


    Your program should define and call a function:
    Function MilesToLaps(float userMiles) returns float userLaps



    Lab 11.2 Driving cost


    Write a function DrivingCost with parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type float.


    Ex: If the function is called with 50 20.0 3.1599, the function returns 7.89975.


    Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both floats). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times.


    Ex: If the input is 20.0 3.1599, the output is:
    1.57995 7.89975 63.198


    Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. In the DrivingCost function, use the variables in the following order to calculate the cost: drivenMiles, milesPerGallon, dollarsPerGallon.



    Lab 11.3 Step counter


    A pedometer treats walking 2,000 steps as walking 1 mile. Write a program whose input is the number of steps, and whose output is the miles walked. If the input is 5345, the output is 2.6725.


    Your program should define and call a function:
    Function StepsToMiles(integer userSteps) returns float numMiles



    Lab 11.4 Leap year


    A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are:


    1) The year must be divisible by 4


    2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400


    Some example leap years are 1600, 1712, and 2016.


    Write a program that takes in a year and determines whether that year is a leap year. If the input is 1712, the output is: 1712 is a leap year. If the input is 1913, the output is: 1913 is not a leap year.


    Your program must define and call a function:


    Function OutputLeapYear(integer inputYear) returns nothing
    The function should output whether the input year is a leap year or not.



    Lab 11.5 Max and min numbers


    Write a program whose inputs are three integers, and whose outputs are the largest of the three values and the smallest of the three values. If the input is 7 15 3, the output is:
    largest: 15
    smallest: 3


    Your program should define and call two functions:
    Function LargestNumber(integer num1, integer num2, integer num3) returns integer largestNum
    Function SmallestNumber(integer num1, integer num2, integer num3) returns integer smallestNum
    The function LargestNumber should return the largest number of the three input values. The function SmallestNumber should return the smallest number of the three input values.



    Lab 11.6 Output values below an amount


    Write a program that first gets a list of six integers from input. The first five values are the integer list. The last value is the upper threshold. Then output all integers less than or equal to the threshold value.


    Ex: If the input is 50 60 140 200 75 100, the output is:
    50 60 75
    For coding simplicity, follow every output value by a space, including the last one.


    Such functionality is common on sites like Amazon, where a user can filter results.


    Your program should define and use a function:
    Function outputIntsLessThanOrEqualToThreshold(integer array(?) userVals, integer upperThreshold) returns nothing

    Learn More
  4. CIS115 Course Project Guess The Number

    CIS115 Course Project Guess The Number

    Regular Price: $15.00

    Special Price: $12.00

    CIS115 Course Project Guess The Number


    You will create a program that will ask the user to guess a number between 1 and 10. The pseudocode is below. Be sure to import random at the beginning of your code and use a comment block explaining what your program does


    #Guess the number week 4
    #Name:
    #Date:
    #Random number, loop while true
    #ask user for number.
    #if number is too high or too low, tell user, if they guessed it break out of loop


    Display "Welcome to my Guess the number program!"
    random mynumber
    while True
     Display "Guess a number between 1 and 10"
     Get guess
     if (guess<mynumber)
      Display "Too low"
     else if (guess>mynumber)
      Display "Too high"
     else if (guess==mynumber)
      Display "You guessed it!"


    When you run your program the result should be something like this:
    Welcome to my Guess the number program!


    Please guess a number between 1 and 10: 5
    Too high
    Please guess a number between 1 and 10: 4
    Too high
    Please guess a number between 1 and 10: 3
    Too high
    Please guess a number between 1 and 10: 2
    You guessed it!


    Be sure to submit your assignment

    Learn More
  5. DAT 210 Week 2 Using Loops in Python

    DAT 210 Week 2 Using Loops in Python

    Regular Price: $12.00

    Special Price: $10.00

    DAT 210 Week 2 Using Loops in Python


    You recently graduated college and you are applying for a programming job that requires the understanding of loops in Python. The manager you are interviewing with has asked you to take an assessment to prove your programming knowledge. Below are the requirements for the programming skills test.

    DAT 210 Week 2 Using Loops in Python


    You recently graduated college and you are applying for a programming job that requires the understanding of loops in Python. The manager you are interviewing with has asked you to take an assessment to prove your programming knowledge. Below are the requirements for the programming skills test.


    In Python, create a program that meets the following requirements:


    • Take two integers from the user.
    • Save the lower number as x.
    • Save the largest integer as y.
    • Write a loop that counts from x to y by twos.
    • Print out the values of that loop using the Print function in Python.
    • Write another loop that adds x and y, and saves the value as Z.
    • Print out the values of Z using the Print function in Python.


    Provide the code and take a screenshot of the output, then paste the screenshot(s) into a Microsoft® Word document.


    Review Chapters 6 and 11 of Python for Everyone if you have additional questions on creating a program in Python.


    Submit your document.


    In Python, create a program that meets the following requirements:


    • Take two integers from the user.


    • Save the lower number as x.


    • Save the largest integer as y.


    • Write a loop that counts from x to y by twos.


    • Print out the values of that loop using the Print function in Python.


    • Write another loop that adds x and y, and saves the value as Z.


    • Print out the values of Z using the Print function in Python.


    Provide the code and take a screenshot of the output, then paste the screenshot(s) into a Microsoft® Word document.


    Review Chapters 6 and 11 of Python for Everyone if you have additional questions on creating a program in Python.


    Submit your document.

    Learn More
  6. CIS115 Week 1 Lab Part 1 Registration Form

    CIS115 Week 1 Lab Building a Registration Form and Pay Calculator in Python

    Regular Price: $12.00

    Special Price: $10.00

    CIS115 Week 1 Lab Building a Registration Form and Pay Calculator in Python


    CIS115 Week 1 Lab Overview


    Title of Lab: Building a Registration Form and Pay Calculator in Python


    Summary – Part 1
    Create a program that allows a student to complete a registration form and displays a completion message that includes the user's full name and a temporary password.


    Summary – Part 2
    Create a program that calculates a user's weekly gross and take-home pay.


    Deliverables
    • 2 source code Python files.
    • A Word document containing both source code and the screen print of the program outputs.


    Lab Steps
    Part 1 – Registration Form


    Sample Output:
    Registration Form
    First Name: Eric
    Last Name: Idle
    Birth Year: 1934
    Welcome Eric Idle!
    Your Registration is complete.
    Your temporary password is: Eric*1934


    Specifications:
    • The user's full name consists of the user's first name, a space, and the user's last name.
    • The temporary password consists of the user's first name, an asterisk (*), and the user's birth year.
    • Assume the user will enter valid data.


    INPUT  PROCESSING         OUTPUT
    first_name password=first_name + "*" + str(birth_year) password
    last_name
    birth_year



    Part 2 – Pay Calculator


    Sample Output:
    Pay Check Calculator
    Hours Worked: 35
    Hourly Pay Rate: 14.50
    Gross Pay: 507.5
    Tax Rate: 18
    Tax Amount: 91.35
    Take Home Pay: 416.15


    • The formula for calculating gross pay is:
     o gross pay = hours worked * hourly rate
    • The formula for calculating tax amount is:
     o tax amount = gross pay * (tax rate / 100)
    • The formula for calculating take home pay is:
     o take home pay = gross pay - tax amount
    • The tax rate should be 18%, but the program should store the tax rate in a variable so that you can easily change the tax rate later, just by changing the value that's stored in the variable.
    • The program should accept decimal entries like 35.5 and 14.25.
    • Assume the user will enter valid data.
    • The program should round the results to a maximum of two decimal places.


    INPUT  PROCESSING           OUTPUT
    hours  gross_pay = round(hours * pay_rate, 2)    gross_pay
    pay_rate tax_rate = 18          tax_rate
       tax_amount = round(gross_pay * (tax_rate / 100), 2) tax_amount
       take_home_pay = round(gross_pay - tax_amount, 2) take_home_pay

    Learn More
  7. CIS115 Week 2 Lab Even or Odd

    CIS115 Week 2 Lab Even or Odd and Grade Checker in Python

    Regular Price: $12.00

    Special Price: $10.00

    CIS115 Week 2 Lab Even or Odd and Grade Checker in Python


    CIS115 Week 2 Lab Overview


    Title of Lab: Even or Odd and Grade Checker in Python


    Summary - Part 1
    Create a program that checks whether a number is even or odd.


    Summary - Part 2
    Create a program that checks one's letter grade.


    Deliverables
    • 2 source code Python files.
    • A Word document containing both source code and the screen print of the program outputs.


    Lab Steps
    Part 1 - Even or Odd


    Sample Output:
    Even or Odd
    Enter an integer: 20
    This is an even number.


    Specifications:
    • Use the selection structure.
    • Assume that the user will enter a valid integer


    Part 2 - Pay Calculator
    Make sure to use the following criteria:
    • 100 - 90: A
    • 89 - 80: B
    • 79 - 70: C
    • 69 - 60: D
    • 59 and below: F


    Sample Output:
    Grade Checker
    Enter your grade: 88
    You earned a B


    • Assume the user will enter valid data.
    • Selection structure needs to be used.

    Learn More
  8. CIS115 Week 3 Lab Change Calculator in Python

    CIS115 Week 3 Lab Change Calculator and Shipping Calculator in Python

    Regular Price: $12.00

    Special Price: $10.00

    CIS115 Week 3 Lab Change Calculator and Shipping Calculator in Python


    CIS115 Week 3 Lab Overview


    Title of Lab: Change Calculator and Shipping Calculator in Python


    Summary - Part 1
    Create a program that calculates the coins needed to make change for the specified number of cents.


    Summary - Part 2
    Create a program that calculates the total cost of an order including shipping.


    Deliverables
    • 2 source code Python files.
    • A Word document containing both source code and the screen print of the program outputs.


    Lab Steps
    Part 1 – Change Calculator


    Sample Output:
    Change Calculator
    Enter number of cents (0-99): 99
    Quarters: 3
    Dimes: 2
    Nickels: 0
    Pennies: 4
    Continue? (y/n): y
    Enter number of cents (0-99): 55
    Quarters: 2
    Dimes: 0
    Nickels: 1
    Pennies: 0
    Continue? (y/n): n
    Bye!


    Specifications:
    • The program should display the minimum number of quarters, dimes, nickels, and pennies that one needs to make up the specified number of cents.
    • Assume that the user will enter a valid integer for the number of cents.
    • The program should continue only if the user enters "y" or "Y" to continue.



    Part 2 – Shipping Calculator


    Sample Output:
    ===============================================================
    Shipping Calculator
    ===============================================================
    Cost of items ordered: 49.99
    Shipping cost:             7.95
    Total cost:                 57.94


    Continue? (y/n): y
    ===============================================================
    Cost of items ordered: -65.50
    You must enter a positive number. Please try again.
    Cost of items ordered: 65.50
    Shipping cost:             9.95
    Total cost:                 75.45


    Continue? (y/n): n
    ===============================================================
    Bye!


    Specifications:
    Use the following table to calculate shipping cost:
    Cost of Items Shipping Cost
    < $30.00  $5.95
    $30.00    - $49.99 $7.95
    $50.00    - $74.99 $9.95
    > $75.00  Free


    • If the user enters a number that’s less than zero, display an error message and give the user a chance to enter the number again.

    Learn More
  9. CIS115 Week 4 Lab Multiplication Table in Python

    CIS115 Week 4 Lab Multiplication Table in Python

    Regular Price: $12.00

    Special Price: $10.00

    CIS115 Week 4 Lab Multiplication Table in Python


    CIS115 Week 4 Lab Overview


    Title of Lab: Multiplication Table in Python


    Summary
    This week's lab is to create a simple multiplication table using nested loops and if statements.
    Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to display a warning if the number is less than 2 or greater than 10 and prompt the user to enter the data again until they enter a valid number.
    Put a # after any even number in your table (odd numbers will have just a space/nothing after them).


    Deliverables
    • A source code Python file.
    • A Word document containing both source code and the screen print of the program outputs.


    Lab Steps


    Sample Output:
    The output should be something similar to the following.
    What size multiplication table would you like? (2 - 10): 1
    Invalid entry - Enter a number between 2 and 10
    What size multiplication table would you like? (2 - 10): 15
    Invalid entry - Enter a number between 2 and 10
    What size multiplication table would you like? (2 - 10): 10


    --- Multiplication Table ( 10 x 10 ) ---
             1      2      3      4      5      6      7      8      9     10
    ---------------------------------------------------------------------------
    1  |     1      2 #    3      4 #    5      6 #    7      8 #    9     10 #
    2  |     2 #    4 #    6 #    8 #   10 #   12 #   14 #   16 #   18 #   20 #
    3  |     3      6 #    9     12 #   15     18 #   21     24 #   27     30 #
    4  |     4 #    8 #   12 #   16 #   20 #   24 #   28 #   32 #   36 #   40 #
    5  |     5     10 #   15     20 #   25     30 #   35     40 #   45     50 #
    6  |     6 #   12 #   18 #   24 #   30 #   36 #   42 #   48 #   54 #   60 #
    7  |     7     14 #   21     28 #   35     42 #   49     56 #   63     70 #
    8  |     8 #   16 #   24 #   32 #   40 #   48 #   56 #   64 #   72 #   80 #
    9  |     9     18 #   27     36 #   45     54 #   63     72 #   81     90 #
    10 |    10 #   20 #   30 #   40 #   50 #   60 #   70 #   80 #   90 #  100 #



    Hints:
    • The outer loop will start each new row.
    • The inner loop will control the display of each column in the row.
    • Note that to keep the numbers right-aligned, there are different amounts of space before single digit numbers (those less than 10), double digit numbers (those between 10-99), and triple digit numbers (100).
    • The row labels can be added to your inner loop (note that there are different amounts of space required after the number in the row labels.
    • The column labels should use a separate loop(s) that run before the main outer loop.
    • You can continue printing on the same line using end="" in your print statement. This will come in handy if you want to print several things on one line inside a loop. For example, assuming the value of name is Ada, the following will print "Hello Ada" on one line:
    print("hello ", end="")
    print(name, end="")


    Tips:
    • Start early!
    • Do the basic table first without worrying about spacing or lining things up, and don't include row or column headings (add those later).
    • Once you get the numbers in the correct position, think about adding the proper amount of space before each number to line things up.
    • Once the columns line up, add the #/space for even/odd numbers.
    • Once the basic table is working, then add the row and column headings, and finally the main title.
    • Test as you go!

    Learn More
  10. CIS115 Week 5 Lab Race Time Sorting in Python

    CIS115 Week 5 Lab Race Time Sorting in Python

    Regular Price: $12.00

    Special Price: $10.00

    CIS115 Week 5 Lab Race Time Sorting in Python


    CIS115 Week 5 Lab Overview


    Title of Lab: Race Time Sorting in Python


    Summary
    Store the times into arrays called Chevy[ ] and Ford[ ]. Then list the winner of each pair, giving the number of seconds the winner won by. At the end declare which team won based on which team had the most wins.


    Deliverables
    • A source code Python file.
    • A Word document containing both source code and the screen print of the program outputs.


    Lab Steps
    There are eight cars in each team called Chevy and Ford. One car from each team races its opponent on the drag strip. Read in the racing times for the eight Chevy cars and then read in the times for the eight Ford cars.


    Sample Match:
    ---Input Chevy Times---
    Enter time for Chevy Car 1: 5.4
    Enter time for Chevy Car 2: 7.2
    Enter time for Chevy Car 3: 4.0
    Enter time for Chevy Car 4: 9.1
    Enter time for Chevy Car 5: 5.8
    Enter time for Chevy Car 6: 3.9
    Enter time for Chevy Car 7: 6.2
    Enter time for Chevy Car 8: 8.1
    ---Input Ford Times---
    Enter time for Ford Car 1: 5.8
    Enter time for Ford Car 2: 6.9
    Enter time for Ford Car 3: 3.9
    Enter time for Ford Car 4: 9.2
    Enter time for Ford Car 5: 5.8
    Enter time for Ford Car 6: 3.8
    Enter time for Ford Car 7: 6.0
    Enter time for Ford Car 8: 8.5
    And the winners are:
    Chevy by 0.4 sec
    Ford by 0.3 sec
    Ford by 0.1 sec
    Chevy by 0.1 sec
    Tie!
    Ford by 0.1 sec
    Ford by 0.2 sec
    Chevy by 0.4 sec
    And the winning team is: F O R D !


    Specifications:
    • Accept the racing times for each of the Chevy cars into the array Chevy[ ].
    • Accept the racing times for each of the Ford cars into the array Ford[ ].
    • Then declare the wining car for each race, giving the winning time in seconds.
    • If the times are identical, then declare the race was a tie.
    • Finally, declare which team won the match, assuming a tie is possible.

    Learn More

Items 1 to 10 of 11 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Ascending Direction