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:
Check the explanation
Explanation:
In C, int requires 4 butes to sotre a integer number. that means it requires 4*8 = 32 bits. The maximum number can be stored using 32 bits is
The first digit is used for sign. decimal equivalent to this number can be computed as
=
=
That means int can store a up to 2147483646.
Testing with C code
#include<stdio.h>
int main()
{
int a = 2147483647; // a with max number
printf("%d\n",a);// printing max number
a = a+1;// adding one to the number
printf("%d\n",a);// printing the number after adding one
return 0;
}
THE OUTPUT
$ ./a.out
2147483647
-2147483648
Answer:
I am writing the Python program:
lyrics = ["I wanna be your endgame", "I wanna be your first string",
"I wanna be your A-Team", "I wanna be your endgame, endgame"]
lines_of_sanity = 6
counter = 0
while counter <= lines_of_sanity+1:
for line in lyrics:
print(line)
counter = counter + 1
print("MAKE IT STOP")
Explanation:
- The lyrics is a list which has the following lines of song.
I wanna be your endgame
I wanna be your first string
I wanna be your A-Team
I wanna be your endgame, endgame
- The value of lines_of_sanity is 6.
- counter variable is initialized to 0.
- The while loop starts which keeps executing until the value of counter becomes greater than 6 which is the value of lines_of_sanity
- The for loop inside the while loop moves through each line of lyrics list and prints that line. The counter variable increments to 1 at each iteration.
- Lets see what the while and for loops print at each iteration:
1st iteration: counter = 0, following line is displayed:
- I wanna be your endgame
- Value of counter increments by 1.
- counter = 1
2nd iteration: counter = 1, following line is displayed:
- I wanna be your first string
- Value of counter increments by 1.
- counter = 2
3rd iteration: counter = 2, following line is displayed:
- I wanna be your A-Team
- Value of counter increments by 1.
- counter = 3
4th iteration: counter = 3, following line is displayed:
- I wanna be your endgame, endgame
- Value of counter increments by 1.
- counter = 4
5th iteration: counter = 4, following line is displayed:
- I wanna be your endgame
- Value of counter increments by 1.
- counter = 5
6th iteration: counter = 5, following line is displayed:
- I wanna be your first string
- Value of counter increments by 1.
- counter = 6
7th iteration: counter = 6, following line is displayed:
- I wanna be your A-Team
- Value of counter increments by 1.
- counter = 7
- The program should keep going to finish out the current verse. So following line is displayed:
- I wanna be your endgame, endgame
- The loop breaks as the value of counter = 7 is greater than lines_of_sanity i.e. 6
- So at last the print("MAKE IT STOP") statement is execute which displays the following line:
- MAKE IT STOP
- The program along with the output is attached.
Dude is u still use this app then friend meh on roblox
Answer:
Spyware is the most harmful virus.
It enters into someones computer as a spy and steals the ones personal information, data and other codes.
Explanation: