Search for question
Question

Post-Lab Tasks: 1. Write a function transitions(s) that takes in a strings of '0's and '1's and returns the number of times there is a transition from a '0' to a 'l' or vice-versa in that input string. For example, transitions ('1110110000') should return 3. new=" Python for us" a='' for i in range (len(new)): a+=new[i] print(a) 2. Write a program that turns a given English word in a sentence into Pig Latin. Pig Latin is a language game of alterations played in English. Here are the rules: In words that begin with consonant sounds, the initial consonant is moved to the end of the word, and an "ay" is added. For example: happy: appyhay . In words that begin with vowel sounds, the syllable "way" is simply added to the end of the word. Ex: I speak Latin in English is iway peaksay atinlay 3. Write a Python program with function find_ch(s,ch) hat returns the index of the first occurrence of a character ch in a string s. You may assume that ch is a single character and do not use find() method. 4. Write a program that takes a string as input and swaps the first with the last letter: example, pooh would become hoop.

Fig: 1