1. Write the outputs of the following loops:
a. for count in range(5): print(count + 1, end = " ")
b. for countinrange(1, 4): print(count, end = " ")
c. for countinrange(1, 6, 2): print(count, end = " ")
d. for countinrange(6, 1, –1): print(count, end = " ")
1. Write the outputs of the following loops: a. for count in range(5): print(count + 1,...
using python 1. Translate the following FOR loops to equivalent WHILE loops: a. for count in range(100): print(count) b. for count in range(1, 101): print(count) c. for count in range(100, 0, –1): print(count)
Using print(), loops, conditionals, and classes write a script that outputs a Fibonacci sequence (every number after the first two is the sum of the two preceding ones): 1, 1, 2, 3, 5, 8, 13,
in C++ plaese: Write double loops that outputs the following: (a) start oxxxxxxx end start ooxxxxxx end start oooxxxxx end start ooooxxxx end start oooooxxx end (b) start 10 5, 10 4, 10 3, 10 2, 10 1, end start 12 5, 12 4, 12 3, 12 2, 12 1, end start 14 5, 14 4, 14 3, 14 2, 14 1, end start 16 5, 16 4, 16 3, 16 2, 16 1, end start 18 5, 18 4,...
(Using MATLAB) Write a program using loops that will print the following multiplication table: 1 2 4 3 6 9 4 8 12 16 5 10 15 20 25
Task 4 Write a script that will print the following table using 2 loops (either for or while) 24 3 6 9 4 8 12 16 5 10 15 20 25
Python
What do the following loops print? Work out the answer by tracing the code, not by using the computer. a. s = 2 for n in range (1, 6): s = s + n print(s) b. s = 1 for n in range (1, 11): n = n + 2 s = s + n print(s) c. S = 1 for in range (1, 6) s = s + n n = n + 1 print(s, n) Rewrite the...
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...
Write the nested loops that cause the output below to print. 1 1 2 2 3 2 3 4 2 3 1 2 1
Write the nested loops that cause the output below to print. 1 1 2 2 3 2 3 4 2 3 1 2 1
Write a program to print five tables (5) displaying the range that a ball would travel when it is thrown with an initial velocity v0 and angle θ. One table should be calculated for each of the initial velocities: 0, 1, 10, 100, and 1000 meters per second. The table should have one row for e very 5 degrees for angles between 5 and 85 degrees inclusive. Note that this assignment does not require a READ statement since all data...
How many times are the while and for loops run in the following code? Count the total number of iterations from both the while loop and for loop. p = 32; t = 8; while t <p t=t+ floor(p/pi); for k = 1:2:10 p = p+2; end end Select one: O a. 42 b. 5 c.o o d. 26 o e.30 me to search