Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a program that takes three numbers as input from the user, and prints the largest.

Sample Run
Enter a number: 20
Enter a number: 50
Enter a number: 5

Largest: 50
Hint: Remember that the numbers should be compared numerically. Any input from the user must be transformed into an integer, but printed as a string.
Consider the following Python function.
def mystery(l):
if l == []:
return(l)
else:
return(mystery(l[1:])+l[:1])
What does mystery([22,14,19,65,82,55]) return?
)
Consider the following Python function.
def mystery(l):
if l == []:
return(l)
else:
return(mystery(l[1:])+l[:1])
What does mystery([22,14,19,65,82,55]) return?


2) What is the value of pairs after the following assignment?
pairs = [ (x,y) for x in range(4,1,-1) for y in range(5,1,-1) if (x+y)%3 == 0 ]


3) Consider the following dictionary.
wickets = {"Tests":{"Kumble":[3,5,2,3],"Srinath":[4,4,1,0],"Prasad":[2,1,7,4]},"ODI":{"Kumble":[2,0],"Srinath":[1,2]}}
Which of the following statements does not generate an error?
wickets["ODI"]["Prasad"][0:] = [4,4]
wickets["ODI"]["Prasad"].extend([4,4])
wickets["ODI"]["Prasad"] = [4,4]
wickets["ODI"]["Prasad"] = wickets["ODI"]["Prasad"] + [4,4]
Consider the following dictionary. wickets = {"Tests":{"Kumble":[3,5,2,3],"Srinath":[4,4,1 ...
1)
Consider the following Python function.
def mystery(l):
if l == []:
return(l)
else:
return(mystery(l[1:])+l[:1])
What does mystery([22,14,19,65,82,55]) return?


2) What is the value of pairs after the following assignment?
pairs = [ (x,y) for x in range(4,1,-1) for y in range(5,1,-1) if (x+y)%3 == 0 ]


3) Consider the following dictionary.
wickets = {"Tests":{"Kumble":[3,5,2,3],"Srinath":[4,4,1,0],"Prasad":[2,1,7,4]},"ODI":{"Kumble":[2,0],"Srinath":[1,2]}}
Which of the following statements does not generate an error?
wickets["ODI"]["Prasad"][0:] = [4,4]
wickets["ODI"]["Prasad"].extend([4,4])
wickets["ODI"]["Prasad"] = [4,4]
wickets["ODI"]["Prasad"] = wickets["ODI"]["Prasad"] + [4,4]
Create a list management application. Include buttons to add items to the list (must be added in the title format),or to delete the selected item from the list. If no item is selected for deletion, then an error message must be displayed. The count for the number of items included in the list must be displayed below the list, with an appropriate message:"There are currently ... cities in the list." You are welcome to enhance your application with comments, messages and graphics. Duplicates may not be entered onto the list. An appropriate error message must be displayed.
n a list of integers l, the neighbours of l[i] are l[i-1] and l[i+1]. l[i] is a hill if it is strictly greater than its neighbours and a valley if it is strictly less than its neighbours.
Write a function counthv(l) that takes as input a list of integers l and returns a list [hc,vc] where hc is the number of hills in l and vc is the number of valleys in l.
Question 1
Create an application using PyQt.The user must be prompted for the name of a country (e.g.Spain) and a single character( e.g 'a').The application must read the name of the country and count the number of occurrences of the character in the country name.The count should be case-insensitive.Thus, if 'c' is entered as the character then both capital letter 'C' and small letter 'c' in the string should be counted.The count must be displayed.The application interface must include at least a label, an edit and a button.You are welcome to enhance your application with comments and messages.
What is the value of pairs after the following assignment?
pairs = [ (x,y) for x in range(4,1,-1) for y in range(5,1,-1) if (x+y)%3 == 0 ]
In a list of integers l, the neighbours of l[i] are l[i-1] and l[i+1]. l[i] is a hill if it is strictly greater than its neighbours and a valley if it is strictly less than its neighbours.
Write a function counthv(l) that takes as input a list of integers l and returns a list [hc,vc] where hc is the number of hills in l and vc is the number of valleys in l.
LATEST TUTORIALS
APPROVED BY CLIENTS