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 18 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Ascending Direction
  1. DAT210 Week 5 Python 6.23 Python insert update sqlite3 datafiles

    DAT/210 Week 5 Python 6.23: Python insert/update sqlite3 datafiles

    Regular Price: $10.00

    Special Price: $4.00

    DAT/210 Week 5 Python 6.23: Python insert/update sqlite3 datafiles


    Given is a Python program that connects to a sqlite database and has one table called writers with two columns:
    • name - the name of a writer
    • num - the number of works the writer has written


    The writers table originally has the following data
    name, num
    Jane Austen,6
    Charles Dickens,20
    Ernest Hemingway,9
    Jack Kerouac,22
    F. Scott Fitzgerald,8
    Mary Shelley,7
    Charlotte Bronte,5
    Mark Twain,11
    Agatha Christie,73
    Ian Flemming,14
    J.K. Rowling,14
    Stephen King,54
    Oscar Wilde,1
    Update the Python program to ask the user if they want to update entries or add new entries. If the name entered already exists in the writers table then the database record is updated, overwriting the original contents. If the name does not exist in the writers table, then add a new record with the writers name and number of works. The following TODO sections must be completed.
    • Check if a writer exists in the writers table
    • If the writer exists in the table, locate an entry to be updated by writers name and update the writer's value for num
    • If the writer does not exist in the table, add a new entry in the writers table and provide the value for name and num


    Ex if the input is:
    y
    J.K. Rowling
    30
    y
    Elton John
    y
    62
    n
    The output is:
    (ID, Name, Num)
    (1, 'Jane Austen', 6)
    (2, 'Charles Dickens', 20)
    (3, 'Ernest Hemingway', 9)
    (4, 'Jack Kerouac', 22)
    (5, 'F. Scott Fitzgerald', 8)
    (6, 'Mary Shelley', 7)
    (7, 'Charlotte Bronte', 5)
    (8, 'Mark Twain', 11)
    (9, 'Agatha Christie', 73)
    (10, 'Ian Flemming', 14)
    (11, 'J.K. Rowling', 30)
    (12, 'Stephen King', 54)
    (13, 'Oscar Wilde', 1)
    (14, 'Elton John', 62)

    Learn More
  2. DAT210 Week 5 Python LAB 6.22 Python and sqlite basics

    DAT/210 Week 5 Python LAB 6.22: Python and sqlite basics

    Regular Price: $10.00

    Special Price: $4.00

    DAT/210 Week 5 Python LAB 6.22: Python and sqlite basics


    Write a Python program that connects to a sqlite database.
    Create a table called Horses with the following fields:
    • id (integer): a primary key and not null
    • name (text)
    • breed (text)
    • height (real)
    • birthday (text)


    Next, insert the following data row into the Horses table:
    id: 1
    name: 'Babe'
    breed: 'Quarter Horse'
    height: 15.3
    birthday: '2015-02-10'
     
    Output all records from the Horses table.
    Ex: With the above row inserted, the output should be:
    All Horses:
    (1, 'Babe', 'Quarter Horse', 15.3, '2015-02-10')

    Learn More
  3. DAT210 Week 5 Python LAB 6.20 Output values in a list below a user defined amount

    DAT/210 Week 5 Python LAB 6.20: Output values in a list below a user defined amount

    Regular Price: $7.00

    Special Price: $4.00

    DAT/210 Week 5 Python LAB 6.20: Output values in a list below a user defined amount


    Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value.


    Ex If the input is:
    5
    50
    60
    140
    200
    75
    100
    the output is:
    50 60 75


    The 5 indicates that there are five integers in the list, namely 50, 60,140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75.
    Such functionality is common on sites like Amazon, where a user can filter results.

    Learn More
  4. DAT210 Week 5 Python LAB 6.19 Max magnitude

    DAT/210 Week 5 Python LAB 6.19: Max magnitude

    Regular Price: $7.00

    Special Price: $4.00

    DAT/210 Week 5 Python LAB 6.19: Max magnitude


    Write a function max_magnitude() with two integer input parameters that returns the largest magnitude value. Use the function in a program that takes two integer inputs, and outputs the largest magnitude value.


    Ex If the inputs are:
    5
    7
    the function returns:
    7


    Ex: If the inputs are:
    -8
    -2
    the function returns:
    -8


    Note: The function does not just return the largest value, which for -8 -2 would be -2. Though not necessary, you may use the built-in absolute value function to determine the max magnitude, but you must still output the input number (Ex Output -8, not 8).
    Your program must define and call the following function:
    def max_magnitude(user_vall, user_val2)


    main.py
    import math
    ''' Define your function here. '''
    if __name__ == '__main__':
     ''' Type your code here. '''

    Learn More
  5. DAT210 Week 4 Python LAB 5.24 Leap year

    DAT/210 Week 4 Python LAB 5.24: Leap year

    Regular Price: $7.00

    Special Price: $3.00

    DAT/210 Week 4 Python LAB 5.24: 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.
    Ex: If the input is:
    1712
    the output is:
    1712 - leap year


    Ex: If the input is:
    1913
    the output is:
    1913 - not a leap year


    main. py
    is_leap_year = False
    input_year = int(input())
    '''Type your code here. '''

    Learn More
  6. DAT210 Week 4 Python LAB 5.23 Seasons

    DAT/210 Week 4 Python LAB 5.23: Seasons

    Regular Price: $7.00

    Special Price: $3.00

    DAT/210 Week 4 Python LAB 5.23: Seasons


    Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day.


    Ex: If the input is:
    April
    11
    the output is:
    Spring


    In addition, check if the string and int are valid (an actual month and day).
    Ex: If the input is:
    Blue
    65
    the output is:
    Invalid


    The dates for each season are:
    Spring: March 20 - June 20
    Summer. June 21 - September 21
    Autumn: September 22 - December 20
    Winter: December 21 - March 19


    main.py
    input_month = input()
    input_day = int(input())
    ''' Type your code here. '''

    Learn More
  7. DAT210 Week 4 Python LAB 5.22 Phone number breakdown

    DAT/210 Week 4 Python LAB 5.22: Phone number breakdown

    Regular Price: $7.00

    Special Price: $3.00

    DAT/210 Week 4 Python LAB 5.22: Phone number breakdown


    Given an integer representing a 10-digit phone number, output the area code, prefix, and line number using the format (800) 555-1212.
    Ex: If the input is: 8005551212
    the output is: (800) 555-1212


    Hint: Use % to get the desired rightmost digits. Ex: The rightmost 2 digits of 572 is gotten by 572 % 100, which is 72.
    Hint: Use // to shift right by the desired amount. Ex: Shifting 572 right by 2 digits is done by 572 // 100, which yields 5. (Recall integer division discards the fraction).
    For simplicity, assume any part starts with a non-zero digit. So 0119998888 is not allowed.


    main.py
    phone_number = int(input())
    ''' Type your code here. '''

    Learn More
  8. DAT210 Week 4 Python LAB 5.21 Expression for calories burned during workout

    DAT/210 Week 4 Python LAB 5.21: Expression for calories burned during workout

    Regular Price: $7.00

    Special Price: $3.00

    DAT/210 Week 4 Python LAB 5.21: Expression for calories burned during workout


    The following equations estimate the calories burned when exercising (source):
    Women: Calories = ((Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184
    Men: Calories = ((Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969) x Time / 4.184


    Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men.
    Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
    print( 'Men: {:.2f} calories'.format(calories_man))


    Ex: If the input is:
    49 155 148 60
    Then the output is:
    Women: 580.94 calories
    Men: 891.47 calories



    main.py
    ''' Women: Calories = ((Age x 0.074) - (Weight x 0.05741) + (Heart Rate x 0.4472) - 20.4022) x Time / 4.184 '''
    ''' Men: Calories = ((Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) - 55.0969) x Time / 4.184 '''
     
    ''' Type your code here. '''

    Learn More
  9. DAT210 Week 4 Python LAB 5.20 Simple statistics

    DAT/210 Week 4 Python LAB 5.20: Simple statistics

    Regular Price: $7.00

    Special Price: $3.00

    DAT/210 Week 4 Python LAB 5.20: Simple statistics


    Given 4 floating-point numbers. Use a string formatting expression with conversion specifiers to output their product and their average as integers (rounded), then as floating-point numbers.
    Output each rounded integer using the following:
    print( '{:.0F}'.format(your_value))
    Output each floating-point value with three digits after the decimal point, which can be achieved as follows:
    print( '{:.3F}'.format(your_value))


    Ex: If the input is:
    8.3
    10.4
    5.0
    4.8
    the output is:
    2072 7
    2071.680 7.125



    main.py
    numl = float(input())
    num2 = float(input())
    num3 = float(input())
    num4 = float(input())
    ''' Type your code here. '''

    Learn More
  10. DAT/210 Week 3 Java LAB 4.17: Data File

    DAT/210 Week 3 Java LAB 4.17: Data File

    Regular Price: $7.00

    Special Price: $3.00

    DAT/210 Week 3 Java LAB 4.17: Data File


    A comma separated value (.csv) file has been included to be used for this program. Each line contains two values, a name and a number separated by a comma (except the first line, which contains the titles for the value types). The name is that of a writer and the number refers to the number of works the writer has written. Ex. Jane Austen,6. Each line is an entry and each entry number can be updated by identifying the associated name.


    Once complete, the following program opens data file allWorks.csv and asks if the user wants to update entries or add new entries. All entries are stored in an array while being read in and updated. The program then writes the array to the file, overwriting the original contents. The following TODO sections must be completed.
    • Open allWorks.csv for reading/input.
    • Locate an entry to be updated by name (use the Java String index0f() method)
    • Add a new entry if the name isn't found in the file (give the entry a new number)
    • Open file allWorks.csv for output
    • Write contents of the array to allWorks.csv (original file is overwritten)


    Ex If the input is:
    y
    J.K. Rowling
    30
    y
    Elton John
    y
    62
    n
    and allWorks.csv originally contains:
    Name,Number of Novels
    Jane Austen,6
    Charles Dickens,20
    Ernest Hemingway,9
    Jack Kerouac,22
    F. Scott Fitzgerald,8
    Mary Shelley,7
    Charlotte Bronte,5
    Mark Twain,11
    Agatha Christie,73
    Ian Flemming,14
    J.K. Rowling,14
    Stephen King,54
    Oscar Wilde,l


    the output in all Works.csv is:
    Name,Number of Novels
    Jane Austen,6
    Charles Dickens,20
    Ernest Hemingway, 9
    Jack Kerouac,22
    F. Scott Fitzgerald,8
    Mary Shelley,7
    Charlotte Bronte,5
    Mark Twain,11
    Agatha Christie,73
    Ian Flemming,14
    J.K. Rowling,30
    Stephen King,54
    Oscar Wilde,l
    Elton John,62

    Learn More

Items 1 to 10 of 18 total

per page
Page:
  1. 1
  2. 2

Grid  List 

Set Ascending Direction