Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

Problem 5: (10 points) Write a Python program that asks a user for a number of days and then computes the equivalent number of years, weeks, and remaining days. You can assume that years are 365 days....

1 answer below »

Problem 5: (10 points)Write a Python program that asks a user for a number of days and then computes the equivalent number of years, weeks, and remaining days. You can assume that years are 365 days. For example if the user enters 746 days you should print to the screen:
That is: 2 years 2 weeks and 2 days.

In[]:

Problem 6: (20 points)RecallProblem 1from your very first assignment. Write a Python program that asks the user for a positive integer and then prints a message indicating whether or not the integer is prime.

In[5]:
# write your code here 

Problem 7: (20 points)Write a python program that asks a user for 10 integers and then sorts them using the selection sort algorith we saw in class. Your algorithm should put the numbers in a list and then use nested loops, just like we saw in class, to sort the list. Do not use the the built-in Pythonsortfunction or thesortedmethod for this.

In[6]:
# write your code here 

Problem 8: (20 points)Write a progam that asks a user for a string and outputs the total number of vowels in the string, the total number of distinct vowels in the string, and then prints each vowel (only once) that is present in the string. So for example, if the user enters: "Mary had a little lamb", your program should print:
There are a total of 6 vowels in the string. There are 3 distinct vowels in the string. They are: 'a', 'i', 'e'.

In[7]:
# write your code here
Answered Same Day Oct 23, 2021

Solution

Neha answered on Oct 24 2021
140 Votes
problem5.py
# This code is find years, weeks and days present in total number of days
# entered by use
DAYS_IN_WEEK = 7
#This function will calculate years, weeks and days
#number of days are passed in this function
def find( number_of_days ):
#days in year is assumed as 365
year = int(number_of_days / 365)
week = int((number_of_days % 365) /
DAYS_IN_WEEK)
days = (number_of_days % 365) % DAYS_IN_WEEK
print("That is:",year ,"years",week, "weeks", days ,"days")
#code will start from here
number_of_days = int(input("Enter number of days"))
find(number_of_days)
problem6.py
#Ask user to enter positive intege
num = int(input("Please enter a positive number: "))
5
if...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here