Presentation is loading. Please wait.

Presentation is loading. Please wait.

AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz What will this print? a = 2 b = 3 c = a/b print c 1 Answer: 0.

Similar presentations


Presentation on theme: "AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz What will this print? a = 2 b = 3 c = a/b print c 1 Answer: 0."— Presentation transcript:

1 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz What will this print? a = 2 b = 3 c = a/b print c 1 Answer: 0

2 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz What will this print? a = 2 b = 3. c = a/b print c 2 Answer: 0.666666666667

3 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz What will this print? a = 2 b = 3 c = 10.0 d = a/b*c e = a*c/b print d,e 3 Answer: 0.0 6.66666666667

4 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz What will this print? from math import * a = 2 b = sqrt(a) print “Square root of”,a,”is”,b 4 Answer: Square root of 2 is 1.41421356237

5 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz What will this print? x = 10768 a = x%10 b = x%100 c = x%1000 print a,b,c 5 Answer: 8 68 768

6 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz: What will this print? x = 38.859 n10 = int(x/10.) x = x%10. n5 = int(x/5.) x = x%5. n2 = int(x/2.) n1 = int(x%2) x = x - int(x) print n10," x 10 euro" print n5," x 5 euro" print n2," x 2 euro" print n1," x 1 euro" print "and",int(100.*x)," cents" 6 Answer: 3 x 10 euro 1 x 5 euro 1 x 2 euro 1 x 1 euro and 85 cents

7 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz: Find the 3 syntax errors 7

8 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz: Find the 3 errors 8 No colon : Missing bracket (2 x) Missing comma (3x)

9 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz: Find the error 9

10 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz: Find the error 10

11 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz: Find the error 11

12 AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz: Find the error 12


Download ppt "AE1205 Programming & Scientific Computing in Python for Aerospace Engineers Quiz What will this print? a = 2 b = 3 c = a/b print c 1 Answer: 0."

Similar presentations


Ads by Google