There are two kangaroos on an x-axis ready to jump in the positive direction (i.e, toward positive infinity). split ( ' ' )) solution = fruit ( s, t, a, b, m, n, apple, orange ) for i in solution : print i 15.Kangaroos Task split ( ' ' )) orange = map ( int, raw_input (). split ( ' ' ) m, n = apple = map ( int, raw_input (). split ( ' ' ) a, b = m, n = raw_input ().
split ( ' ' ) s, t = a, b = raw_input (). #!/bin/python import sys def fruit ( s, t, a, b, m, n, apple, orange ): cApple = cOrange = 0 for i in range ( 0, m ): l = apple + a if l >= s and l = s and l <= t : cOrange += 1 return ( cApple, cOrange ) s, t = raw_input (). The fifth line contains n space-separated integers denoting the respective distances that each orange falls from point b. The fourth line contains m space-separated integers denoting the respective distances that each apple falls from point a. The third line contains two space-separated integers denoting the respective values of m and n. The second line contains two space-separated integers denoting the respective values of a and b. The first line contains two space-separated integers denoting the respective values of s and t. Given the value of for apples and oranges, can you determine how many apples and oranges will fall on Sam’s house (i.e., in the inclusive range ) Print the number of apples that fall on Sam’s house as your first line of output, then print the number of oranges that fall on Sam’s house as your second line of output. A negative value of means the fruit fell units to the tree’s left, and a positive value of means it falls units to the tree’s right. When a fruit falls from its tree, it lands units of distance from its tree of origin along the -axis. You can assume the trees are located on a single point, where the apple tree is at point and the orange tree is at point. The apple tree is to the left of his house, and the orange tree is to its right. In the diagram below, the red region denotes his house, where is the start point and is the end point. Sam’s house has an apple tree and an orange tree that yield an abundance of fruit.
In the fifth line, print True if has any uppercase characters. In the fourth line, print True if has any lowercase characters. In the third line, print True if has any digits. In the second line, print True if has any alphabetical characters. In the first line, print True if has any alphanumeric characters. Input FormatĪ single line containing a string. Your task is to find out if the string contains: alphanumeric characters, alphabetical characters, digits, lowercase and uppercase characters. Sample InputĪ = string.find(sub_string,i,len(string))Ĭount = count_substring(string, sub_string) Print one line: The average of the marks obtained by the particular student correct to 2 decimal places. The final line contains the name of a particular student previously listed.
The next N lines contains the name and marks obtained by that student separated by a space. The first line contains the integer N, the number of students. Output the average percentage marks obtained by that student, correct to two decimal places. You are required to save the record in a dictionary data type. The user enters some integer N followed by the names and marks for N students. Each record contains the student’s name, and their percent marks in Maths, Physics and Chemistry.