Hey!
---------------------------------------------------
Definition:
A "for loop" is something used for repeating things over a list of items. For instance, a list or a dictionary.
Code:
colors = ["red", "green", "blue"]
for x in colors:
print(x)
---------------------------------------------------
Definition:
A "while loop" is is something used for carrying out a set of lines that are true.
Code:
n = 1
while i < 4:
print(n)
n += 1
---------------------------------------------------
Real-Life Example:
A real-life example would if I was a manager or boss for a company say that everyone was off a certain day. Like, if I said everyone was off for Christmas the 25th. If I had 1000 employees that would take a very long time to send an email to everyone. Instead of sending an email to everyone I can program code that uses "for loops" and "while loops" to create a message and send it to everyone.
---------------------------------------------------
Hope This Helped! Good Luck!
Answer:
i dont know how too i dont think you can
Answer:
She is 17 her fav color is Blue And her fav subject is Science
Explanation:
Answer:
TRUE, The PC is always incremented by the same amount in fixed-length instruction set architectures.
Explanation:
Its TRUE that Program Counter ( PC ) is always incremented by the same amount in fixed - length instruction set architectures ( fixed length ISA) . As the instruction set length is fixed in fixed - length instruction set architectures, the Program Counter to fetch the next instruction set it has to be incremented by fixed length. This fixed length depends on the hardware of the architecture (the number of bytes each machine word contains and number of machine words per memory location)
Answer:
Explanation:
Let's do this in Python, we shall use the package random to generate a random double between 0 and 1. Then we multiply it with 50 and covert to integer to get a random integer between 0 and 50. Place a While function with condition to stop when it's greater than 25
from random import random
attempts = 1
random_int = int(random()*50)
print(random_int)
print("This is attempt " + attempts)
while random_int <= 25:
attempts += 1
random_int = int(random()*50)
print(random_int)
print("This is attempt " + attempts)