String Manipulation in Scratch

Strings are either single characters, words or sentences. 
Examples of strings: “A”, “b”, “I like Pi”, “$400”, “(^_^)”, “Sentences etc.”



Variables can store strings 


You can pull out individual letters from a String using this block:
Each letter is part of an index that includes spaces.
In the example above, letter 1 is “a”, letter 2 is “p”, and so forth.
If my phrase were “apple juice” instead, letter six would be a space and letter seven would be a “j”.


Please find and write the correct letters based on these four code prompts:







String Concatenation: This refers to the combination of one or more strings using the “join block.” join(“A”,”B”)=”AB”
                                                                        Write Answer here


String Length: the length of the string is simply the number of characters in it. For example length(“I like Pi”) = 9
Write Answer Here


User Input: When we are designing an application, we need to make choices regarding how our program takes in data from the user (person who is using the application). One way is to ask directly.
   
Once the user has provided a response, it will be held temporarily in the “answer” data block. You can then store it. 



Assignments: 


Find letter 15 of the “Friends, Romans, Countrymen” string:


Join two variables with string data (make this difference from the example)


Get the length of this string “102193801232312132312”:


Take in user input (answer a question of your own choice) and store this in a variable. Find the letter 9 (if it exists) and length. Get another piece of user input and join the two strings. Print your final result. 


Experiment with the arithmetic and string operators. What happens when you try to add two strings together?

Challenge: A Chromosome is being built by four letters (‘A’ - Adenine; ‘T’ - Thymine; ‘G’ - Guanine; ‘C’ - Cytosine). Use the random number generator to manually record values between 1-4 on a piece of paper. Create a legend explaining which letter corresponds to which number (i.e. 1-A; 2-T; 3-G; 4-C). Use the join method to create a new string with your gene (i.e. ATGACCCGT).

4 comments:

  1. 운동 부족으로 몸이 굳어 있었는데 전문 관리가 포함된 오산출장마사지 이용 후 몸이 훨씬 유연해지고 움직임이 편해졌습니다.

    ReplyDelete
  2. 예상치 못한 지출이 생겨 당황했지만, 소액현금화를 통해 빠르게 해결할 수 문화상품권할인. 복잡한 서류 없이 진행할 수 있어 시간 절약이 되었고, 긴급 상황에서 꽤 도움이 되는 방식이라고 느꼈습니다.

    ReplyDelete
  3. 집에서 편하게 받을 수 있어 만족스러웠어요. 수원출장마사지 서비스는 시간 절약에도 좋고 피로를 빠르게 풀어줘 바쁜 일상 속 힐링 시간을 만들어줍니다.

    ReplyDelete
  4. 오랜 컴퓨터 작업으로 굳어 있던 목과 어깨가 부드럽게 풀렸어요. 출장마사지 덕분에 컨디션 회복에 도움이 되어 다음 날까지 몸이 편안했습니다.

    ReplyDelete