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

what is the output? x = 9 % 2

if (x == 1):
  print ("ONE")
else:
  print ("TWO")
SBN-13 is a new standard for indentifying books. It uses 13 digits d1d2d3d4d5d6d7d8d910d11d12d13 . The last digit d13 is a checksum, which is calculated from the other digits using the following formula:

10 - (d1 + 3*d2 + d3 + 3*d4 + d5 + 3*d6 + d7 + 3*d8 + d9 + 3*d10 + d11 + 3*d12) % 10

If the checksum is 10, replace it with 0. Your program should read the input as a string. Display “incorrect input” if the input is incorrect.
Write a program that accepts a time as an hour and minute. Add 15 minutes to the time, and output the result.
Create a calendar program that allows the user to enter a day, month and year in three separate variables. Then ask the user to select from a menu of choices using this formatting:

Please enter a date
Day:
Month:
Year:

Menu:
1) Calculate the number of days in the given month.
2) Calculate the number of days left in the given year.

It must include the following functions:
leap_year: Takes the year as a parameter and returns a 1 if a year is a leap year (Links to an external site.)Links to an external site.and 0 if it is not. This information will only be used by other functions.

number_of_days: This subprogram will accept the date as parameters and return how many days are in the given month (Links to an external site.)Links to an external site..

days_left: This will accept the date as parameters and then calculate the number of days left in the year. This should not include the date the user entered in the count.
what is a possible output of "print (random.random()*5)"
Write the definition of a class Counter containing:
An instance variable counter of type int, initialized to 0.
A method called increment that adds one to the instance variable counter. It does not accept parameters or return a value.
A method called get_value that doesn't accept any parameters. It returns the value of the instance variable counter.
Write a program to output the following:

**********
* *
* PYTHON *
* *
**********
Write a program to output the following:

**********
* *
* PYTHON *
* *
**********
Write a program that uses two input statements to get two words as input. Then, print the words on one line separated by a space.
Write a function matched(s) that takes as input a string s and checks if the brackets "(" and ")" in s are matched: that is, every "(" has a matching ")" after it and every ")" has a matching "(" before it. Your function should ignore all other symbols that appear in s. Your function should return True if s has matched brackets and False if it does not.

Hint: Keep track of the nesting depth of brackets. Initially the depth is 0. The depth increases with each opening bracket and decreases with each closing bracket. What are the constraints on the value of the nesting depth for all brackets to be matched?

Here are some examples to show how your function should work.


>>> matched("zb%78")
True

>>> matched("(7)(a")
False

>>> matched("a)*(?")
False

>>> matched("((jkl)78(A)&l(8(dd(FJI:),):)?)")
True
LATEST TUTORIALS
APPROVED BY CLIENTS