COSC 235: Programming and Problem Solving Chapter 3: Arithmetic vs Numerics Instructor: Dr. X 1
Topics Data types Algebra vs Numerics Math… library in Python! Accumulator? What does this mean? 2
What are computers used for? Number crunching Anything else?
Buying books Suppose the cover price of a book is $24.95, but bookstores get a 40% discount. Shipping costs $3 for the first copy and 75 cents for each additional copy. What is the total wholesale cost for 60 copies? Write a program that calculates the total wholesale price of copies given that the book price, discount percentage, and number of copies are given by the user.
What did you just do? What data types did you use? What is the meaning of the word “gozinta”?
Libraries Why do we need coding libraries? Who has created them? Can we create our own libraries?
Explore Math Write a program that returns the exponent of a number x, i.e., your program should return e x Your program should ask the user to give a number x Then it should print exponent of the number Test your program!! How can you make sure it produces the right output?
Accumulator Programs Divide and Conquer Build piece by piece
References “Python Programming: An Introduction to Computer Science”, 2 nd ed., John M. Zelle 9