Question

In: Computer Science

Write a code in Python jupytoer note book: Ask the user to input a year. Check...

Write a code in Python jupytoer note book:

  1. Ask the user to input a year. Check if this is a leap year or not.

  • Ask the user to input a number. Check if this number is even or odd.

  • HbA1c of 6.5% or higher indicates diabetes. 5.7 to 6.4 indicates pre-diabetes. HbA1c less than 5.7 is considered normal. Ask the user for their HbA1c level and display if their they are in the normal range, pre-diabetic, or diabetic.

  • Ask the user to input a character and check if it is a vowel.

  • Ask the user for three numbers and find the highest of the three numbers.

  • In assignment 4.1 you completed, check if Joe made a profit or incurred a loss.

Solutions

Expert Solution

#Answer 1

year=int(input("Enter year: "))

if (( year%400 == 0)or (( year%4 == 0 ) and ( year%100 != 0))):

print("%d is a Leap Year" %year)

else:

print("%d is Not the Leap Year" %year)

  

#Answer 2

number=int(input("Enter number"))

if number %2==0:

  print(number," is even")

else:

  print(number," is odd")

#Answer 3:

hba=float(input("Enter HbA1c level: "))

if hba >=6.5:

  print("Diabetes")

if hba >=5.7 and hba <6.4:

  print("pre-Diabetes")

else:

  print("Normal")

#Answer 4:

letter=input("Enter letter: ")

if letter=="a" or letter=="e" or letter=="i" or letter=="o" or letter=="u":

  print(letter," is vowel")

else:

  print(letter," is not vowel")

#Answer 5:

num1=int(input("Enter number 1: "))

num2=int(input("Enter number 2: "))

num3=int(input("Enter number 3: "))

if num1>num2 and num1 >num3:

  print("Max number : ",num1)

elif num2>num3:

  print("Max number : ",num2)

else:

  print("Max number : ",num3)


  


Related Solutions

Write a Python code that will ask a user to input a year and return "Leap...
Write a Python code that will ask a user to input a year and return "Leap Year" if the year is a leap year, or "No Leap Year" if it is not a leap year. The program then asks for another year and performs the same task in the form of a loop, until the user inputs the then integer "-1." At that point, the program will exit the loop.
Write a Python program that will ask the user to input a word, will return the...
Write a Python program that will ask the user to input a word, will return the first letter of the input word, and ask the user to put another word, and so on, in the form of a loop. If the user chooses to stop, he or she should input the integer "0" for the loop to stop.
PYTHON Write a python program that encrypts and decrypts the user input. Note – Your input...
PYTHON Write a python program that encrypts and decrypts the user input. Note – Your input should be only lowercase characters with no spaces. Your program should have a secret distance given by the user that will be used for encryption/decryption. Each character of the user’s input should be offset by the distance value given by the user For Encryption Process: Take the string and reverse the string. Encrypt the reverse string with each character replaced with distance value (x)...
In python Write the code to ask a user to enter a number in the range...
In python Write the code to ask a user to enter a number in the range of 1-100. Have the code checked to make sure that it is in this range. If it is not, let the user re-enter the number. The user should be able to re-enter numbers until the number is within the correct range.
Write a Python function that will do the following:1. Ask the user to input an integer...
Write a Python function that will do the following:1. Ask the user to input an integer which will be appended to a list that was originally empty. This will be done 5 times, meaning that when the input is complete, the list will have five elements (all integers).2. Determine whether each element is an even number or an odd number3. Return a list of five-string elements "odd" and "even" that map the indexes of the elements of the input list,...
1. Write Python code to - (a) ask user to enter a list of animals, one...
1. Write Python code to - (a) ask user to enter a list of animals, one item at a time, until “done” to terminate input (b) randomly display a selected item from the list, starting with “I like ______”. When run, the output should look something like this: Enter an item; 'done' when finished: cats Enter an item; 'done' when finished: dogs Enter an item; 'done' when finished: guinea pigs Enter an item; 'done' when finished: done You are done...
Python Program Write a program that will ask a user on how many input colored balls...
Python Program Write a program that will ask a user on how many input colored balls of the following codes: R-red, B-blue, W-white, G-green and O-orange -will he or she would like to enter in the program and print the total number of Red balls were encountered. Assume an uppercase and lower case letter will be accepted.
Write code to ask user to provide input length in miles, yards, feet and inches and...
Write code to ask user to provide input length in miles, yards, feet and inches and write code to convert sum of total length into meters. Display result by reiterating input values in inches, feet, yards, and miles entered by user, and the sum of the total length in meters. PLEASE use bluej for code
In python. Projectile motion: Write a python program that will ask the user for      an...
In python. Projectile motion: Write a python program that will ask the user for      an initial height y0, initial velocity v, launch angle theta, and mass m.      Create two functions, one that will calculate max height      of the projectile, and one that will calculate the range. Ask the     user which one he/she would like to calculate, then present them with the answer. (use kg, m and m/s)
python: ask the user to input a sequence of positive numbers. the end of the sequence...
python: ask the user to input a sequence of positive numbers. the end of the sequence is determined when the user enters a negative number. print out the maximum number from the sequence. output: keep entering positive numbers. to quit, input a negative number. enter a number: 67 enter a number: 5 enter a number: 8 enter a number: -3 largest number entered: 67 (note: i do not want to ask the user how many numbers they will input)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT