Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The user enters the ages in years as non-negative whole numbers (e.g. 2). age1 input (How old are you? age2 input (Hou old is

image text in transcribed
1. The user enters the ages in years as non-negative whole numbers (e.g. 2). age1 input ("How old are you? age2 input ("Hou old is your best friend? #aiss ing line of code print (result) Which of the following lines of code makes the program above print the sum of the two ages? (a) reault int (age1) + int (age2) (b) result - agelage2 (c) result str(agel age2) (d) result int (age1+ age2) (e) result str(int(agel age2)) 2, what does )*#3 evaluate too? (b) 3 ( 0% 3 (a) 0 (d) 27 (e) cases a crash (c) 9 3. What does the following code fragment print? digits '0123456789' result 100 for digit in digits: (a) 100 (b) 55 (c) 9 (d) o (e) It crashes. result result - int(digit) print (result) 4. What does the following code fragment print? t-[True, 'or not', 100] print(type(t[1]), type(q)) (a) (b) (c) (d) (e) 5. As in your Assignment 1, question 3, let variables xs, ys and side refer to the x- and y-coordin of the bottom-left corner of a square and its side length, respectively, which of the following fragments returns True if a point with coordinates x and y is inside or on the square and F 1) return x>=xs and xcexs+side and y >. ys and y-xs or x-ys or y

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started