SECOND ASSIGNMENT 1)Write a function to check whether a number falls in a given range sol: min = int(input("Enter min value in range : ")) max = int(input("Enter max value in range : ")) n = int(input("Enter a number : ")) if(min<=n<=max): print("In range") else: print("Not in range") 2) Some board games require you to reduce the number of cards you are holding by half, rounded down. For instance, if you have 10 cards, you would reduce to 5 and if you had 11 cards you would also reduce to 5. With 12 cards you would reduce to 6. Write a program that asks the user to enter how many cards they have and print out what their hand would reduce to under this rule. sol: n = int(input("Enter a numner ")) print(n//2) 3)Write a program that asks the user to enter a positive integer. Then generate a random number between that number and 10 more than that number and print the letter A that many times on the same line. sol: from random import randint as r n = int(input("Enter a number : ")) result = r(n,n+10) print("A"*result) 4) This is a very simple billing program. Ask the user for a starting hour and ending hour, both given in 24-hour format (e.g., 1 pm is 13, 2 pm is 14, etc.). The charge to use the service is $5.50 per hour. Print out the user’s total bill. You can assume that the service will be used for at least 1 hour and never more than 23 hours. Be careful to take care of the case that the starting hour is before midnight and the ending time is after midnight. sol: start = int(input("Enter starting hour : ")) end = int(input("Enter ending hour : ")) print("Users total bill = ",end = " ") if(end - start >0): print((end - start)*5.5,"$") else: print((24 - (start - end))*5.5,"$") 5) One way to estimate probabilities is to run what is called a computer simulation. Here we will estimate the probability of rolling doubles with two dice (where both dice come out to the same value). To do this, run a loop 10,000 times in which random numbers are generated representing the dice and a count is kept of how many times doubles appear. Print out the final percentage of rolls that are doubles. sol: from random import randint as r count = 0 for i in range(10000): res1 = r(1,6) res2 = r(1,6) if(res1 == res2): count += 1 print("Probability of doubles = ",end= " ") print(count/10000)