Show the output from the following fragments:
for i in range(4):
print("Hello")
The
range(4)
fucntion returns
[ 0, 1, 2, 3 ]
So, the loop traverses the list. Hence, the loop runs 4 times and at each time it prints Hello.
So, the output is
Hello
Hello
Hello
Hello
Show the output from the following fragments: for i in range(4): print("Hello")
Show the output produced by each of the following program fragments. Assume that I, j, k are int variables i = 7; j = 2; printf(“%d %d ”, i / j, i % j); i = 4; j = 3; printf(“%d”, (i + 10 ) % j); i = 7; j = 8; k = 9; printf("%d”, (i + 10) % k / j); Show the output produced by each of the following program fragments. Assume that I, j, k...
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...
print(" |",end=' ')
for i in range(1,10):
print(i,end=' ')
print()
for i in range(0,11):
print('-',end=' ')
print()
for i in range(1,10):
for j in range(0,11):
if j==0:
print(i,end=' ')
elif j==1:
print('|',end=' ')
elif i==9 and j==10:
print(i*(j-1),end=' ')
elif i>=4 and j>=4:
print('*',end=' ')
else:
print(i*(j-1),end=' ')
print()
This code is not working I need help
1 2 3 4 5 6 7 8 9 --- --- -------------------- -------------------- 5 10 15 X 6 12 18 X 7 8...
Explain please
II. (7 points) Consider the following bit of pseudocode: for (int k = 1; ks Ign; k++) (for (int i = 1; i r: i++) Print "Hello World"; for (int j-1;jsn:j++) Print "Hello World" when n = 2, how many times will "Hello World" be printed? When n 4, how many times will "Hello World be printed? O Assuming that the print is the basic operation, what is the complexity function of this pseudocode?
II. (7 points) Consider...
PSUEDOCODE ONLY!! What is the output of the following code? CREATE x 1 SWITCH (x) Print output here: Print output here: BREAK CASE 2: PRINTLINE (“hELLO wORLD”) CASE 3: PRINT (“HELLO WORLD”) BREAK CASE 4: PRINTLINE(“Hello”) CASE 5: PRINT(“World”) BREAK DEFAULT: BREAK
Hello,
how should the code be if I want the output to be like in the
image?
it is python 3.7
For example: Test Result print numbers(00 print numbers(3) 0 1. 2
C++
Programming
QUESTION 10 Based on the following C++ code, what is the output of "pvari->print(" function call? class A public void print cout << "Hello from A": 1 virtual void print2() {cout << "Hello from A2";} class B public A public void print) { cout << "Hello from B:1 virtual void print2() {cout << "Hello from B2": 1 int main() Avari Apvarl-new B; return 0; 1 o a Hello from A2 ob Hello from B O Hello from A...
CHALLENGE ACTIVITY CCY7.10.5: Read user input and print to output. Assign user_str with a string from user input, with the prompt: 'Enter a string:" Hint- Replace the ? in the following code: user_str?('Enter a string: ') Note: These activities may test code with different pre-entered test values, thus blank print statements are placed after the prompt so that output will appear on the following line. This activity will perform two tests: the first with user input of "Hello", the second...
python how can I print "Hello 55!" how can i add the exclamation mark at the end using a comma to add my variable? name = 55 print( "Hello", name )
What is wrong with the following code snippet? print("Hello") print("World!") The print function cannot be called twice The print function is missing an argument Nothing, the program prints Hello World on the same line The second line should not be indented