Python please
What output is displayed from the following block of code?
x = 12
if x >= 13 or x <= 19:
print ("Teen")
else:
print ("Not a Teen")
Initially x value is 12.
if 12 >= 13(false) or 12 <= 19(True):
Here we use or logic so any of the logic is true then the statement is true.
Since 12 <= 19(True) so the statement if x >= 13 or x <= 19: is true.
print ("Teen") # It print teen
Output:
Teen
Python please What output is displayed from the following block of code? x = 12 if...
Python: 1) What output is generated by the following code segment? table = [["T", "U", "V"], ["W", "X", "Y"]] print(table[0]) Group of answer choices a- T b- ["T", "W"] c- ["T", "U", "V"] d- [["T", "U", "V"], ["W", "X", "Y"]] 2) Consider the following code segment: values = [4, 12, 0, 1, 5] print(values[1]) What is displayed when it runs? Group of answer choices a- 0 b- 1 c- 4 d- 12 3) Consider the following code segment: x =...
1 Show the output from the following Python code fragment: for i in [ 12, 4, -2]: print (2 * i) 2 Write a Python program findAverage to find the average of the numbers in a range defined by two inputs num1 and num2, where the values of num1 and num2 are entered by the user. For example, a call to findAverage(2,10) would find the average of the numbers 2,3,4,5,6,7,8,9 (note the final "10" is NOT included!). The output...
What is the output of the following Python code if the user enters 4? count = int(input()) the_sum = 0 for i in range (1, count): the_sum = the_sum + i print("Sum is", the_sum)
QUESTION 4 Consider the following block of Python code, where variables age_1, age_2 and age_3 each store integer values: if age_1 > age_2: if age_2 > age_3: print(age_3) else: print(age_2) elif age_1 > age_3: print(age_3) else: print(age_1) Which of the following options best describes the purpose of the above code? To print the largest of the values stored in age_1, age_2 and age_3 To print the largest of the values stored in age_1 and age_2 only To print the largest...
Show the source code if possible or code writen with output please and thank you <3 6. Is the following a legal Python program? def proc(x, y): return 2*x + y*y def main(): print(proc(5)) main() 7. Is the following a legal Python program? def proc(x): return 2*x def main(): print(proc(5, 4)) main() 8. Is the following a legal Python program? def proc(x): print(2*x*x) def main(): proc(5) main()
12. What is the output of the following C++ code? int x; int y; int *p = &x; int *q = &y; *p = 35; *q = 98; *p = *q; cout << x << " " << y << endl; cout << *p << " " << *q << endl; 13. What is the output of the following C++ code? int x; int y; int *p = &x; int *q = &y; x = 35; y = 46; p...
Please Help with the code below not sure where my error is...Thanks. Program output displayed here: Davy's auto shop services Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12 Enter the first service from the menu: Traceback (most recent call last): File "main.py", line 9, in choice1 = input("Enter the first service from the menu: "); EOFError: EOF when reading a line Here is the code: # Type your code here services =...
In Python: What is the output of the following code? for i in range(5): if i == 2: continue print(i) Question 22 options: 0 1 2 4 0 1 3 4 0 1 3 0 1 4
In python What is the output of below code? print(len(“what’s up”))
What will be printed for the code below: age = 15 if (age < 13) { print ("child") } else if (age >= 13 & age <=19) { print ("teenager") } else { print ("adult") } What will be the output of the code below: for(i in 1:100) { if(i <= 20){ print (i) }