Skip to content

Created a simple calculator in Python. Repository also contains a few fun Python list, dictionary related problems.

jg00/a004-python-calculator

Repository files navigation

a004-python-calculator

Repository Notes

Created a simple calculator in Python. Repository also contain a few fun Python list related problems.

Main items

  • Created a Calculator with Python (calculator-v2.py)
  • Sample list problems (lists_practice.py)
  • Dictionary exercises (dictionary_exercises.rtf, dictionaries.py)
  • Letter Summary - builds a dictionary based on tally of letters used in a word (dictionary_exercises.rtf, letter_summary.py)

File - calculator-v2.py

Calculator - Prompts user for two numbers and an operand. Prgrams runs until user clicks 'q'.

File - lists_practice.py

Fun Python list related problems

Sum the Numbers Given an list of numbers, print their sum. When I say given something, just make something up and store it in a variable.

Largest Number Given an list of numbers, print the largest of the numbers.

Smallest Number Given an list of numbers, print the smallest of the numbers.

Even Numbers Given an list of numbers, print each number in the list that is even.

Positive Numbers Given an list of numbers, print each number in the list that is greater than zero.

Positive Numbers II Given an list of numbers, create a new list which contains every number in the given list which is positive.

Multiply a list Given an list of numbers, and a single factor (also a number), create a new list consisting of each of the numbers in the first list multiplied by the factor. Print the new list out to the screen.

Multiply Vectors Given two lists of numbers of the same length, create a new list by multiplying the pairs of numbers in corresponding positions in the two lists. Example:

[2, 4, 5] x [2, 3, 6] = [4, 12, 30]

Matrix Addition Given two two-dimensional lists of numbers of the size 2x2 two dimensional list is represented as an list of lists:

[ [2, -2], [5, 3] ] Calculate the result of adding the two matrices. The number in each position in the resulting matrix should be the sum of the numbers in the corresponding addend matrices. Example: to add

1 3 2 4 and

5 2 1 0 results in

6 5 3 4

Matrix Addition II Use your solution in Matrix Addition, and extend it to work for a pair of matrices of any size, as long as they have the same size.

File - dictionary_exercises.rtf

This file contains exercise related info for dictionaries.py, letter_summary.py

About

Created a simple calculator in Python. Repository also contains a few fun Python list, dictionary related problems.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages