#3-1###################################################
"""Write a program that generates and prints 50 random
integers, each between 3 and 6."""

##from random import randint
##for i in range(50):
##    x=randint(3,6)
##    print(x,sep=" ",end=" ")
    

#3-2####################################################
"""Write a program that generates a random number, x,
between 1 and 50, a random number y
between 2 and 5, and computes x raised to the y power."""

##from random import randint
##x=randint(1,50)
##y= randint(2,5)
##compute = x**y
##print("x = " + str(x))
##print("y = " + str(y))
##print(str(x) + "^" + str(y)+ " = " + str(compute))



#3-3######################################################
"""Write a program that generates a random number between
1 and 10 and prints your name that many times."""

##from random import randint
##x=input("Enter your name:")
##n = randint(1,10)
##print("Your name printed",n,"times is")
##for i in range(n):
##    print(x)

#3-4######################################################
"""Write a program that generates a random decimal number
between 1 and 10 with two decimal places of accuracy.
Examples are 1.23, 3.45, 9.80, and 5.00."""

##import random
##x = round(random.uniform(1,10),2)
##print(x)

#3-5######################################################
""" Write a program that generates 50 random numbers such
that the first number is between 1 and 2, the second is
between 1 and 3, the third is between 1 and 4, . . . , and
the last is between 1 and 51."""

##from random import randint
##for i in range(1,51):
##    print("number ",i, "= ",randint(1,i+1))

#3-6######################################################
"""Write a program that asks the user to enter two numbers,
x and y, and computes |x-y|/(x+y) ."""

##x = eval(input("Enter the value of x: "))
##y = eval(input("Enter the value of y: "))
##print(abs(x-y)/(x+y))

#3-7######################################################
""" Write a program that asks the user to enter an angle
between −180 degrees and 180 degrees. Using an expression
with the modulo operator, convert the angle to its
equivalent between 0 degrees and 360 degrees. """

##x=eval(input("Enter an angle between -180 and 180 degrees: "))
####  modulo gives the remainder, so the positive value, must
####  return itself, which requires addition to 360, while the
####  negative angle returns a value less than 360
##print("The equivalent of the angle on the range between 0 and 360 degrees is", (x+360)%360)

#3-8######################################################
"""Write a program that asks the user for a number of
seconds and prints out how many minutes and seconds that
is. For instance, 200 seconds is 3 minutes and 20 seconds.
[Hint: Use the // operator to get minutes and the %
operator to get seconds.]"""

##totalSeconds= eval(input("Enter the number of seconds: "))
##minutes = int(totalSeconds /60)
##seconds = totalSeconds % 60
##print("The time is" , minutes,"minutes and", seconds,"seconds")

#3-9######################################################
""""Write a program that asks the user for an hour between
1 and 12 and for how many hours in the future they want to
go. Print out what the hour will be that many hours into
the future.
An example is shown below.
Enter hour: 8
How many hours ahead? 5
New hour: 1 o'clock
"""

##hour = eval(input("Enter the the  Current Hour between 1-12 : "))
##projected_hour = eval(input("Enter Projected Hour: "))
##current_hour = hour + projected_hour
##if current_hour > 12:
##    current_hour = current_hour % 12
##print("New Hour:",current_hour,"o'clock")

#3-10######################################################
"""
(a) One way to find out the last digit of a number is to
mod the number by 10. Write a program that asks the user to
enter a power. Then find the last digit of 2 raised to that
power."""

##exp = eval(input("Enter an exponent: "))
##lastDigit = 2**exp%10
##print("The last digit of 2^" + str(exp),"is",lastDigit)



#3-11######################################################
"""Write a program that asks the user to enter a weight in
kilograms. The program should convert it to pounds, printing
the answer rounded to the nearest tenth of a pound."""

#### 1kg = 2.20462 Pounds
#### 1/10 meaning pound is rounded to one decimal number
##weight_kg = eval(input("Enter Your Weights in Kg: "))
##kg_to_pound = round(weight_kg * 2.20462,1)
##print("Your Weight in Pounds is :",kg_to_pound)

#3-12######################################################
"""Write a program that asks the user for a number and
prints out the factorial of that number."""

##number=eval(input("Enter a number: "))
##factorial =1
##if number == 0:
##    print("Factorial of this number does not exist")
##elif number ==1:
##    print("Factorial of 1 is 1")
##else:
## for number in range(1,number+1):
##    factorial = factorial * number
##print(str(number) + "! =",factorial)
    

#3-13###################################################### 
""" Write a program that asks the user for a number and then
prints out the sine, cosine, and tangent of that number. """

##from math import  sin ,cos ,tan
##number = eval(input("Enter a number: "))
##print("The sine is: ", sin(number),"The cosine is: ",cos(number),"The tangent is: ",tan(number))


#3-14###################################################### 
"""  Write a program that asks the user to enter an angle
in degrees and prints out the sine of that angle.  """

##from math import*
##import  math
##degrees = eval(input("Enter degrees: "))
##radians = math.radians(degrees)
##print("The sin of", str(degrees), "degrees is:", sin(radians))


#3-15###################################################### 
"""  Write a program that prints out the sine and cosine of
the angles ranging from 0 to 345 degrees in 15 degree
increments. Each result should be rounded to 4 decimal
places. Sample output is shown below:
0 --- 0.0 1.0
15 --- 0.2588 0.9659
30 --- 0.5 0.866
...
345 --- -0.2588 0.9659   """

##import math
##from math import *
##for i in range(0,346,15):
##    j = math.radians(i)
##    print(i,"---",round(sin(j),4),round(cos(j),4))


#3-16###################################################### 
""""Below is described how to find the date of Easter in
any year. Despite its intimidating appearance, this is not
a hard problem. Note that bxc is the floor function, which
for positive numbers just drops the decimal part of the
number. For instance b3.14c = 3. The floor function is part
of the math module.
C = century (1900’s ==> C = 19)
Y = year (all four digits)
m = (15 + C 􀀀 b C
4
c 􀀀 b 8C+13
25
c) mod 30
n = (4 + C 􀀀 b C
4
c) mod 7
a = Y mod 4
b = Y mod 7
c = Y mod 19
d = (19c + m) mod 30
e = (2a + 4b + 6d + n) mod 7
Easter is either March (22+d+e) or April (d+e􀀀9). There is
an exception if d = 29 and e = 6.  In this case, Easter
falls one week earlier on April 19. There is another
exception if d = 28, e = 6, and m = 2, 5, 10, 13, 16, 21,
24, or 39. In this case, Easter falls one week earlier
on April 18. Write a program that asks the user to enter
a year and prints out the date of Easter in that year.
(See Tattersall, Elementary Number Theory in Nine Chapters,
2nd ed., page 167)"""


##TODO

#3-17###################################################### 
"""" A year is a leap year if it is divisible by 4, except
that years divisible by 100 are not leap years unless they
are also divisible by 400. Ask the user to enter a year,
and, using the // operator, determine how many leap years
there have been between 1600 and that year. """


##yearIn = eval(input("Enter a year: "))
##for year in range(1600,yearIn):
##    #if year % 4 == 0 or year % 100 == 0 and year % 400 == 0:
##    if (year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)):
##        print(year)



#3-18###################################################### 
""""18. Write a program that given an amount of change less
than $1.00 will print out exactly how many quarters, dimes,
nickels, and pennies will be needed to efficiently make that
change. [Hint: the // operator may be useful.]"""

##To fully understand this problem you have to understand
##what are the differences between quarters ,dimes ,nickels
##and pennies.
import sys
""" Quarter = 25cents
    Dime = 10cents
    Nickel = 5cents
    Penny = 1cent    
"""

##number = eval(input("Enter a number beween 0-99: "))
##if number < 0 or number > 99:
##    print("You entered a number in the wrong range!!!!!")
##    sys.exit()
##else:
##      qs = number // 25
##      remainder = number % 25
##      ds = remainder // 10
##      remainder = remainder % 10
##      ns = remainder // 5
##      ps = remainder // 1
##print("quarters=",qs,"dimes=",ds,"nickels=",ns,"pennies =",ps)


#3-19###################################################### 
""""Write a program that draws “modular rectangles” like
the ones below. The user specifies the width and height of
the rectangle, and the entries start at 0 and increase
typewriter fashion from left to right and top to bottom,
but are all done mod 10. Below are examples of a 3X5
rectangle and a 4X8.
0 1 2 3 4
5 6 7 8 9
0 1 2 3 4

0 1 2 3 4 5 6 7
8 9 0 1 2 3 4 5
6 7 8 9 0 1 2 3
4 5 6 7 8 9 0 1"""

##width = int(input("Enter width: "))
##height = int(input("Enter height: "))
##ctr = 0
##for i in range(0,height):
##    for j in range(width):
##        print(ctr%10,end="")
##        ctr = ctr + 1
##    print()
