Computer Science, asked by huvassha4700, 8 months ago

What does h(19685) return for the following function definition?

def h(x): (d,n) = (1,0) while d <= x: (d,n) = (d*3,n+1) return(n)​

Answers

Answered by Anonymous
2

Answer:

Answer:

 &lt;svg id="wrap" width="300" height="300"&gt;</p><p></p><p>&lt;!-- background --&gt;</p><p>&lt;svg&gt;</p><p>&lt;circle cx="150" cy="150" r="130" style="stroke: lightblue; stroke-width:18; fill:transparent"/&gt;</p><p>&lt;circle cx="150" cy="150" r="115" style="fill:#2c3e50"/&gt;</p><p>&lt;path style="stroke: #2c3e50; stroke-dasharray:820; stroke-dashoffset:820; stroke-width:18; fill:transparent" d="M150,150 m0,-130 a 130,130 0 0,1 0,260 a 130,130 0 0,1 0,-260"&gt;</p><p>&lt;animate attributeName="stroke-dashoffset" dur="6s" to="-820" repeatCount="indefinite"/&gt;</p><p>&lt;/path&gt;</p><p>&lt;/svg&gt;</p><p></p><p>&lt;!-- image --&gt;</p><p>&lt;svg&gt;</p><p>&lt;path id="hourglass" d="M150,150 C60,85 240,85 150,150 C60,215 240,215 150,150 Z" style="stroke: white; stroke-width:5; fill:white;" /&gt;</p><p></p><p>&lt;path id="frame" d="M100,97 L200, 97 M100,203 L200,203 M110,97 L110,142 M110,158 L110,200 M190,97 L190,142 M190,158 L190,200 M110,150 L110,150 M190,150 L190,150" style="stroke:lightblue; stroke-width:6; stroke-linecap:round" /&gt;</p><p></p><p>&lt;animateTransform xlink:href="#frame" attributeName="transform" type="rotate" begin="0s" dur="3s" values="0 150 150; 0 150 150; 180 150 150" keyTimes="0; 0.8; 1" repeatCount="indefinite" /&gt;</p><p>&lt;animateTransform xlink:href="#hourglass" attributeName="transform" type="rotate" begin="0s" dur="3s" values="0 150 150; 0 150 150; 180 150 150" keyTimes="0; 0.8; 1" repeatCount="indefinite" /&gt;</p><p>&lt;/svg&gt;</p><p></p><p>&lt;!-- sand --&gt;</p><p>&lt;svg&gt;</p><p>&lt;!-- upper part --&gt;</p><p>&lt;polygon id="upper" points="120,125 180,125 150,147" style="fill:#2c3e50;"&gt;</p><p>&lt;animate attributeName="points" dur="3s" keyTimes="0; 0.8; 1" values="120,125 180,125 150,147; 150,150 150,150 150,150; 150,150 150,150 150,150" repeatCount="indefinite"/&gt;</p><p>&lt;/polygon&gt;</p><p></p><p>&lt;!-- falling sand --&gt;</p><p>&lt;path id="line" stroke-linecap="round" stroke-dasharray="1,4" stroke-dashoffset="200.00" stroke="#2c3e50" stroke-width="2" d="M150,150 L150,198"&gt;</p><p>&lt;!-- running sand --&gt;</p><p>&lt;animate attributeName="stroke-dashoffset" dur="3s" to="1.00" repeatCount="indefinite"/&gt;</p><p>&lt;!-- emptied upper --&gt;</p><p>&lt;animate attributeName="d" dur="3s" to="M150,195 L150,195" values="M150,150 L150,198; M150,150 L150,198; M150,198 L150,198; M150,195 L150,195" keyTimes="0; 0.65; 0.9; 1" repeatCount="indefinite"/&gt;</p><p>&lt;!-- last drop --&gt;</p><p>&lt;animate attributeName="stroke" dur="3s" keyTimes="0; 0.65; 0.8; 1" values="#2c3e50;#2c3e50;transparent;transparent" to="transparent" repeatCount="indefinite"/&gt;</p><p>&lt;/path&gt;</p><p></p><p>&lt;!-- lower part --&gt;</p><p>&lt;g id="lower"&gt;</p><p>&lt;path d="M150,180 L180,190 A28,10 0 1,1 120,190 L150,180 Z" style="stroke: transparent; stroke-width:5; fill:#2c3e50;"&gt;</p><p>&lt;animateTransform attributeName="transform" type="translate" keyTimes="0; 0.65; 1" values="0 15; 0 0; 0 0" dur="3s" repeatCount="indefinite" /&gt;</p><p>&lt;/path&gt;</p><p>&lt;animateTransform xlink:href="#lower" attributeName="transform"</p><p>type="rotate"</p><p>begin="0s" dur="3s"</p><p>values="0 150 150; 0 150 150; 180 150 150"</p><p>keyTimes="0; 0.8; 1"</p><p>repeatCount="indefinite"/&gt;</p><p>&lt;/g&gt;</p><p></p><p>&lt;!-- lower overlay - hourglass --&gt;</p><p>&lt;path d="M150,150 C60,85 240,85 150,150 C60,215 240,215 150,150 Z" style="stroke: white; stroke-width:5; fill:transparent;"&gt;</p><p>&lt;animateTransform attributeName="transform"</p><p>type="rotate"</p><p>begin="0s" dur="3s"</p><p>values="0 150 150; 0 150 150; 180 150 150"</p><p>keyTimes="0; 0.8; 1"</p><p>repeatCount="indefinite"/&gt;</p><p>&lt;/path&gt;</p><p></p><p>&lt;!-- lower overlay - frame --&gt;</p><p>&lt;path id="frame" d="M100,97 L200, 97 M100,203 L200,203" style="stroke:lightblue; stroke-width:6; stroke-linecap:round"&gt;</p><p>&lt;animateTransform attributeName="transform"</p><p>type="rotate"</p><p>begin="0s" dur="3s"</p><p>values="0 150 150; 0 150 150; 180 150 150"</p><p>keyTimes="0; 0.8; 1"</p><p>repeatCount="indefinite"/&gt;</p><p>&lt;/path&gt;</p><p>&lt;/svg&gt;</p><p></p><p>&lt;/svg&gt;

Similar questions