```yes = "y" or "Y"
no = "n" or "N"
quest1 = input("solved problem 1: " + yes + "/" + no + " ")
quest2 = input("solved problem 2: " + yes + "/" + no+ " ")

if quest1 or quest2 == no:
elif quest1 or quest2 == yes:
print("You should not come to class.")
exit()

quest3 = input("solved part 1: " + yes + "/" + no + " ")
quest4 = input("solved part 2: " + yes + "/" + no+ " ")
quest5 = input("solved part 3: " + yes + "/" + no + " ")
quest6 = input("solved part 4: " + yes + "/" + no+ " ")

```

#how can I count these y/n into the number of times of occurrences as output? so I can use if statements to print as per the number of times yes and no is answered. Oct 13 in Python
edited Oct 13 107 views

## 1 answer to this question.

Hi, @Reshma,

You can go through this as an example:

```def count(a, b, m, n):

# If both first and second string

# is empty, or if second string

# is empty, return 1

if ((m == 0 and n == 0) or n == 0):

return 1

# If only first string is empty

# and second string is not empty,

# return 0

if (m == 0):

return 0

# If last characters are same

# Recur for remaining strings by

# 1. considering last characters

#    of both strings

# 2. ignoring last character

#    of first string

if (a[m - 1] == b[n - 1]):

return (count(a, b, m - 1, n - 1) +

count(a, b, m - 1, n))

else:

return count(a, b, m - 1, n)

print(count(a, b, len(a),len(b)))```

Output:

`4` answered Oct 13 by Lisa sanyal

+1 vote

## How do I find out the sum of digits of a number in Python?

Hi, good question. If you are considering ...READ MORE

## How do I get the number of elements in a list?

Hello, The len() function can be used with several different ...READ MORE

## In NumPy how do I get the maximum of subsets? Python

You can use np.maximum.reduceat: >>> _, idx = np.unique(g, ...READ MORE

## How can I get the count of a list in Python?

len() >>> mylist=[] >>> print len(mylist) 0 READ MORE

## How can I record the X,Y limits of a displayed X,Y plot using the matplotlib show() module?

A couple hours after posting this question ...READ MORE

## How do I access a user by his/her ID using django.contrib.auth.models.User in the latest release of Django?

Hi, there is only that way and ...READ MORE

## How do I obtain the index list in a NumPy Array of all the NaN values present using Python?

Hi, it is pretty simple, to be ...READ MORE

## how do I check the length of an array in a python program?

lets say we have a list mylist = ...READ MORE