Git Product home page Git Product logo

python_simple_code's Introduction

Python Simple Code

Python3|Online IDE You can test this project using Online Python Editor and IDE

Requirements

Question1

Write a program that displays the following data:
The average annual change in population during the time period.
The year with the greatest increase in population during the time period.
The year with the smallest increase in population during the time period.

The following list holds the population counts as at the end of the year, for six years, starting in 2012.

population = [34372, 37821, 45673, 67100, 69100, 70245] 

Question2

Your program contains the following data lists:

studentName = ["Terry", "John", "Susan", "Rondell", "Aaron", "Kalifa"]
studentGrade = [[79, 85, 82], [65, 69, 73], [91, 93, 80], [45, 70, 81], [83, 85, 80], [90, 93, 82]]

These data lists contain the names of students and the corresponding set of grades for each student. 

Create the following functions:
calculateAverage(studentName): returns the average of a student's grades according to the name supplied.
lowestGrade(studentName): returns the lowest grade for a student according to the name supplied.
highestGrade(studentName): returns the highest grade for a student according to the name supplied.

Then, in a main() function, write code that accepts a name from the user, and displays the following text, with the corresponding data:

Name:
Lowest Grade: 
Highest Grade:
Average Grade:

Question3

The following dictionary contains the list of US states with their abbreviations as keys and full names as values:

states = {
        'AK': 'Alaska',
        'AL': 'Alabama',
        'AR': 'Arkansas',
        'AS': 'American Samoa',
        'AZ': 'Arizona',
        'CA': 'California',
        'CO': 'Colorado',
        'CT': 'Connecticut',
        'DC': 'District of Columbia',
        'DE': 'Delaware',
        'FL': 'Florida',
        'GA': 'Georgia',
        'GU': 'Guam',
        'HI': 'Hawaii',
        'IA': 'Iowa',
        'ID': 'Idaho',
        'IL': 'Illinois',
        'IN': 'Indiana',
        'KS': 'Kansas',
        'KY': 'Kentucky',
        'LA': 'Louisiana',
        'MA': 'Massachusetts',
        'MD': 'Maryland',
        'ME': 'Maine',
        'MI': 'Michigan',
        'MN': 'Minnesota',
        'MO': 'Missouri',
        'MP': 'Northern Mariana Islands',
        'MS': 'Mississippi',
        'MT': 'Montana',
        'NA': 'National',
        'NC': 'North Carolina',
        'ND': 'North Dakota',
        'NE': 'Nebraska',
        'NH': 'New Hampshire',
        'NJ': 'New Jersey',
        'NM': 'New Mexico',
        'NV': 'Nevada',
        'NY': 'New York',
        'OH': 'Ohio',
        'OK': 'Oklahoma',
        'OR': 'Oregon',
        'PA': 'Pennsylvania',
        'PR': 'Puerto Rico',
        'RI': 'Rhode Island',
        'SC': 'South Carolina',
        'SD': 'South Dakota',
        'TN': 'Tennessee',
        'TX': 'Texas',
        'UT': 'Utah',
        'VA': 'Virginia',
        'VI': 'Virgin Islands',
        'VT': 'Vermont',
        'WA': 'Washington',
        'WI': 'Wisconsin',
        'WV': 'West Virginia',
        'WY': 'Wyoming'
}
Write a program that randomly displays an abbreviation from this list, 
and then asks the user to enter the full name that matches that abbreviation. Once the user guesses, 
let the user know whether they are correct or incorrect. 
If they are incorrect, display the correct answer to the user.

Todos

  • Write MORE Tests
  • Add Night Mode

License

MIT Free Software, Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.