Presentation is loading. Please wait.

Presentation is loading. Please wait.

COSC 235: Programming and Problem Solving Chapter 3: Arithmetic vs Numerics Instructor: Dr. X 1.

Similar presentations


Presentation on theme: "COSC 235: Programming and Problem Solving Chapter 3: Arithmetic vs Numerics Instructor: Dr. X 1."— Presentation transcript:

1 COSC 235: Programming and Problem Solving Chapter 3: Arithmetic vs Numerics Instructor: Dr. X 1

2 Topics Data types Algebra vs Numerics Math… library in Python! Accumulator? What does this mean? 2

3 What are computers used for? Number crunching Anything else?

4 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.

5 What did you just do? What data types did you use? What is the meaning of the word “gozinta”?

6 Libraries Why do we need coding libraries? Who has created them? Can we create our own libraries? https://c1.staticflickr.com/1/130/376152628_249e3630c0_b.jpg

7 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?

8 Accumulator Programs Divide and Conquer Build piece by piece http://bigdata.ices.utexas.edu/wp-content/uploads/2014/03/divide-and-conquer1.png

9 References “Python Programming: An Introduction to Computer Science”, 2 nd ed., John M. Zelle 9


Download ppt "COSC 235: Programming and Problem Solving Chapter 3: Arithmetic vs Numerics Instructor: Dr. X 1."

Similar presentations


Ads by Google