100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
TM111 TMA02. EXAM-with 100% verified solutions- $10.49   Add to cart

Exam (elaborations)

TM111 TMA02. EXAM-with 100% verified solutions-

 87 views  0 purchase

TM111 TMA02. EXAM-with 100% verified solutions-

Preview 2 out of 7  pages

  • June 16, 2023
  • 7
  • 2022/2023
  • Exam (elaborations)
  • Questions & answers
All documents for this subject (1)
avatar-seller
puritymaina
TM111 TMA02. EXAM -with 100% verified solutions -2023 -2024 Question 1 A. Complete the following step-by-step description of what the when[space]key_pressed script does when the user starts the program with the green flag, then presses their space key, and enters 'Sami' , and then 34. Your description should make clear what data is stored in the variables and the list involved, and the result of any comparison that is made . The user is asked to enter a pupil's name. Their input, 'Sami', is stored in the variable name. The user is asked to enter the number of lengths the pupil can swim…. Algorithm Explanation: • Green Flag is Clicked – This will delete any existing pupil’s name in the “dolphin_badge_list ” variable • When Space Key is Pressed - This will perform the following steps o Wait to enter Pupil’s Name – Enter “Sami” ▪ Sami will be stored in the variable “name ” o Wait to enter the number of lengths the pupil can swim – Enter “34” ▪ 34 will be stored in the variable “number_of_lengths ” o Percentage Length is computed multiplying the value of “number_of_lengths ” to 2.5 ▪ The result will be stored in the variable “lengths_percentage ” o Say – The program will output the concatenation of the value of “lengths_percentage ” and “%” for 2 seconds o If condition - If the computed “lengths_percentage ” value is greater than 75 then ▪ "Sami” will be inserted to the “dolphin_badge_list ” variable B. I. Identify a numerical value in this program that might appropriately be stored in a constant. (There may be more than one possibility but you are only required to identify one. You are not asked to implement this constant. Ans: The number 75 in the if condition II. What might be an appropriate name for the constant you have chosen? Ans: The possible constant name is “ threshold_percentage ” which indicates a below lower limit percentage value. C. Amend the when_green_flag_clicked and when[space]key_pressed scripts so that: • if a pupil can swim more than 75% of the maximum number of lengths their name is added to the list dolphin_badge_list • otherwise their name is added to a list duckling_badge_list (which you should create and initialise appropriately).

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller puritymaina. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $10.49. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

82871 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$10.49
  • (0)
  Add to cart