#4-1###################################################
"""Write a program that asks the user to enter a length
in centimeters. If the user enters a negative length,
the program should tell the user that the entry is
invalid. Otherwise, the program should convert the
length to inches and print out the result. There are
2.54 centimeters in an inch."""

##import sys
##length_cm = eval(input("Enter the length in centimeters: "))
##if length_cm < 0:
##    print("You entered an invalid number")
##    sys.exit()
##else:
##    length_inches = length_cm / 2.54
##    print(length_inches," inches")

#4-2####################################################
"""Ask the user for a temperature. Then ask them what
units, Celsius or Fahrenheit, the temperature is in.
Your program should convert the temperature to the other
unit. The conversions are:
F = 9/5*C + 32 and
C = 5/9*(F - 32)."""

##import sys
##temp = int(input("Enter a temperature: "))
##units = input("What units C or F :")
##if units == "F" :
##    c = 5/9*(temp-32)
##    print("Your temperature in Celcius is: ", c)    
##elif units =="C":
##    f= 9/5*temp + 32
##    print("Your temperature in Fahrenheit is: ", f)
##else:
##    print("You entered wrong Units")
    

#4-3######################################################
"""Ask the user to enter a temperature in Celsius. The
program should print a message based on the temperature:
• If the temperature is less than -273.15, print that the
temperature is invalid because it is below absolute zero.
• If it is exactly -273.15, print that the temperature is
absolute 0.
• If the temperature is between -273.15 and 0, print that
the temperature is below freezing.
• If it is 0, print that the temperature is at the freezing
point.
• If it is between 0 and 100, print that the temperature is
in the normal range.
• If it is 100, print that the temperature is at the boiling
point.
• If it is above 100, print that the temperature is above
the boiling point."""

##absolute_zero = -273.15
##temp_celsius = eval(input("Enter temperature in Celsius: "))
##if temp_celsius < absolute_zero:
##    print("Temperature is invalid and below absolute zero")
##elif temp_celsius == absolute_zero:
##    print("The temperature is absolute zero")
##elif temp_celsius >= absolute_zero and temp_celsius <= 0:
##    print("Temperature is below freezing point")
##elif temp_celsius == 0:
##    print("Temperature is at freezing point")    
##elif temp_celsius > 0 and temp_celsius < 100:
##    print("Temperature is in normal range")
##elif temp_celsius == 100:
##    print("The temperature is at boiling point")    
##elif temp_celsius > 100:
##    print("The temperature is above boiling point")
    


#4-4######################################################
"""Write a program that asks the user how many credits
they have taken. If they have taken 23 or less, print that
the student is a freshman. If they have taken between 24
and 53, print that they are a sophomore. The range for
juniors is 54 to 83, and for seniors it is 84 and over."""

##credits_taken = eval(input("Emter the number of credit taken: "))
##if credits_taken <= 23:
##    print("You are a freshman")
##elif credits_taken <= 53:
##    print("You are a sophomore")
##elif credits_taken <= 83:
##    print("You are a junior")
##else:
##    print("Congrats You are a senior")


#4-5######################################################
"""Generate a random number between 1 and 10. Ask the user
to guess the number and print a message based on whether
they get it right or not."""

##from random import randint
##random_number = randint(1,10)
##while True:
##    guess = eval(input("Enter your guess between 1-10 inclusive: "))
##    if guess == random_number:
##        print("You guessed right!")
##        break
##    elif guess > random_number:
##        print("Your guess is greater than random number")
##    else:
##        print("Your guess is less than random number")


#4-6######################################################
"""A store charges $12 per item if you buy less than 10
items. If you buy between 10 and 99 items, the cost is $10
per item. If you buy 100 or more items, the cost is $7 per
item. Write a program that asks the user how many items
they are buying and prints the total cost."""

##items = eval(input("How many items do you want to buy: "))
##if items < 10:
##    print("Total price is: $",items*12)
##elif items in range(10,100):
##    print("Total price is: $",items*10)
##else:
##    print("Total price is: $",items*7 )
    

#4-7######################################################
"""Write a program that asks the user for two numbers and
prints Close if the numbers are within .001 of each other
and Not close otherwise."""

##num1 = eval(input("Enter number 1: "))
##num2 = eval(input("Enter number 2: "))
##diff = abs(num1-num2)
##if (diff <= 0.001):
##     print("Close")
##else:
##     print("Not close")
     
#4-8######################################################
"""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. Write a program that asks the
user for a year and prints out whether it is a leap year
or not."""

##year = eval(input("Enter a year: "))
##if (year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)):
##    print(year,"is a leap year")
##else:
##    print(year,"is not a leap year")


#4-9######################################################
"""Write a program that asks the user to enter a number
and prints out all the divisors of that number. [Hint: the
% operator is used to tell if a number is divisible by
something."""

##number = eval(input("Enter a number: "))
##for i in range(1,number//2+1):
##    if number % i == 0:
##        print(i)
        
#4-10######################################################
""""Write a multiplication game program for kids. The
program should give the player ten randomly generated
multiplication questions to do. After each, the program
should tell them whether they got it right or wrong and what
the correct answer is. """

##from random import  randint
##questions = 0
##for questions in range(3):
##    num1 = randint(1, 10)
##    num2 = randint(1, 10)
##    questions += 1
##    print("Question " + str(questions) + ": ",num1,"X",num2)
##    solution =eval(input("Enter Solution: "))
##    if(solution == num1 * num2):
##      print("Correct!")
##    else:
##       print("Incorrect.", num1,"X",num2,"=",num1*num2)



#4-11######################################################
"""Write a program that asks the user for an hour between
1 and 12, asks them to enter am or pm, and asks them how
many hours into the future they want to go. Print out what
the hour will be that many hours into the future, printing
am or pm as appropriate. An example is shown below.
Enter hour: 8
am (1) or pm (2)? 1
How many hours ahead? 5
New hour: 1 pm """


##hourIn = eval(input("Enter hour: "))
##ampm = eval(input("am (1) or pm(2)?: "))
##hoursAhead = eval(input("How many hours ahead (max = 11): "))
##if (ampm == 1):
##    if (hourIn + hoursAhead == 12):
##        print("1New hour =","12 pm")
##    elif (hourIn + hoursAhead > 12): 
##        print("2New hour =",hourIn + hoursAhead - 12,"pm")
##    else:
##        print("3New hour =",hourIn + hoursAhead,"am")
##else:
##    if (hourIn + hoursAhead == 12):
##        print("4New hour =","12 am")
##    elif (hourIn + hoursAhead > 12): 
##        print("5New hour =",hourIn + hoursAhead - 12,"am")
##    else:
##        print("6New hour =",hourIn + hoursAhead,"pm")
  
    

        
   



#4-12######################################################
"""A jar of Halloween candy contains an unknown amount of
candy and if you can guess exactly how much candy is in the
bowl, then you win all the candy. You ask the person in
charge the following: If the candy is divided evenly among
5 people, how many pieces would be left over? The answer is
2 pieces. You then ask about dividing the candy evenly among
6 people, and the amount left over is 3 pieces. Finally, you
ask about dividing the candy evenly among 7 people, and the
amount left over is 2 pieces. By looking at the bowl, you can
tell that there are less than 200 pieces. Write a program to
determine how many pieces are in the bowl."""


##for candies in range(200):
##    if (candies % 5 != 2):
##        continue
##    if (candies % 6 != 3):
##        continue
##    if (candies % 7 != 2):
##        continue
##    print(str(candies) + " is the answer!")
##    break


#4-13######################################################    
"""Write a program that lets the user play Rock-Paper-Scissors
against the computer. There should be five rounds, and after
those five rounds, your program should print out who won and
lost or that there is a tie."""

##from random import  randint
##game = 0
##rock = 1
##paper =2
##scissors =3
##wins =0
##loose =0
##for game in range(5):
##    print("Game",game,"Start")
##    my_hand = eval(input("Choose Rock , paper or scissors: "))
##    computer_hand = randint(1, 3)
##    if my_hand == computer_hand :
##        print ("You and Computer Played the same hand its a tie..")
##    elif my_hand == rock and computer_hand == scissors:
##        print("Yay I crushed the computer scissors")
##        wins += 1
##    elif my_hand == rock and computer_hand == paper:
##        print("Oops Computer Cover my Rock")
##        loose += 1
##    elif my_hand == paper and computer_hand == rock:
##        print("Yay!! I covered computer rock haha")
##        wins += 1
##    elif  my_hand == paper and computer_hand == scissors:
##        print("Oops Computer cut me up into piece")
##        loose += 1
##    elif my_hand == scissors and computer_hand == rock:
##        print("Oops Computer Shattered My scissors")
##        loose += 1
##    elif my_hand == scissors and computer_hand == paper:
##        print("Yay I cut up computer paper into pieces")
##        wins += 1
##if wins > loose:
##    print("You win ", "You Scored ",wins,"Computer Scored",loose)
##else:
##    print("You loosed Try Again")
    
    
