The program illustrates the use of loops and conditions.
Loops are used for repetitions, while conditions are used to make decisions
The game program in Python, where comments are used to explain each line is as follows:
#This initializes the point to 100
point = 100
#The following loop is repeated 4 times
for i in range(4):
#This gets the current action
action = input("Hit or Miss: ")
#This following if statement calculates the point
if action.lower() == "hit":
point+=10
else:
point-=20
#This prints the calculated point
print(point)
Read more about loops and conditions at:
brainly.com/question/14284157
Answer:
int count;
for (int i = 1; i <= 100; i++){
count = 0;
for (int j = 1; j <=i; j++)
if (i%j==0) count ++;
if (count == 2) cout << i << " ";
}
Dictary = {
'code':6734,
'dept': 'sales',
123-45-6789:"Mr.Potato Head \n234 Potato Lane \nPotato Chip, ID 77725"
}
for i in Dictary.keys():
if i == 123-45-6789:
print(Dictary.get(i))
break
else:
print("Key not found")
You can further test this code by deleting Mr.Potato head's info from the dictionary. I hope this helps!
Answer:
I am attaching a doc file
Explanation:
The file contains the Python and C++ program for this and also the screenshots of the program and the outputs.