《Python语言程序设计(美-梁勇)第3章(英文)习题解答(共4页).doc》由会员分享,可在线阅读,更多相关《Python语言程序设计(美-梁勇)第3章(英文)习题解答(共4页).doc(4页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上Chapter 3 Mathematical Functions, Strings, and Objects1. 2.True3.r = math.radians(47)4.r = math.degrees(math.pi / 7)5.code = ord(1)code = ord(A)code = ord(B)code = ord(a)code = ord(b)ch = chr(40)ch = chr(59)ch = chr(79)ch = chr(85)ch = chr(90)6.print()print()7.u00788.D9.2510.title = cha
2、pter + str(1)11.52312.An object is an entity such as a number, a string, a student, a desk, and a computer. Each object has an id and a type. Objects of the same kind have the same type. You can perform operations on an object. The operations are defined using functions. The functions for the object
3、s are called methods in Python 13.To find the id for an object, use the id(object) function. To find the type for an object, use the type(object) function.14.(b)15.s.lower() is tgeorgians.upper() is tGEORGIAn16.s.strip() is GoodtMorning17.The return returned from invoking the format function is a st
4、ring.18.The width is automatically increased to accommodate the size of the actual value.19. 57.468.957.40 57.4020.5.747e+01 1.2e+075.74e+01 5.74e+0121. 5789.4685789.468 5789.405789.40 5789.4022. 45.747%45.747% 23. 4545 2d2d 24.Programming is fun Programming is fun Programming is fun25.turtle.home()26.turtle.dot(3, red)27.Draw a square28.turtle.speed(number) # Set a number between 1 to 10, the larger, the faster29.turtle.undo()30.turtle.color(red)31.turtle.begin_fill()turtle.color(red)turtle.circle(40, steps = 3) # Draw a triangle.turtle.end_fill()32.turtle.hide()专心-专注-专业