Computer Science, asked by HM207, 11 months ago

Write a Python script to display the following message on the screen
The professor said, “Please don’t sleep in the class”.
“Opportunities don’t happen. You create them.”
Try not to become a person of “success” but try to become a person of “value”.

Answers

Answered by avku
0

Answer:

Explanation:

number = input("Enter a five digit number: ")

total = 0

#loop to repeat five times

for x in range(0,5):

#x is used to see how many digits have been checked

#if x is 0 this is the first time through the loop, therefore digit 1 is being checked, 2 is digit 3 and 4 is digit 5.

if x == 0 or x == 2 or x == 4:

#if it is digit 1,3 or 5 then it will add the number to the total

#the number is retrieved from the variable number by using x to get the correct digit

total = total + int(number[x])

else:

#if it is digit 2 or 4 then it will subtract the number from the total

total = total - int(number[x])

#the final total will be printed, this is after the loop has finished

print("The final total is: " + str(total))


HM207: It's not the answer
Answered by Anonymous
0

Answer:

{\bold{\red{\huge{Your\:Answer}}}}

Explanation:

File "<stdin>", line 1

   The professor said, “Please don’t sleep in the class”.

               ^

 File "<stdin>", line 2

“Opportunities don’t happen. You create them.”

         ^

 File "<stdin>", line 3

Try not to become a person of “success” but try to become a person of “value”.

 

Similar questions