a) Write a program that reads a string as input from the user. Implement defensive programming so that the string is not empty.
b) Then, print the string after removing the character in position N (1 up to the length of the string) that will be indicated by the user. Implement defensive programming so that the position indicated by the user is valid.
c) Finally, ask the user for a character and return the number and percentage of appearances of that character in the original string.We assume that one machine offers four different types of drinks (coffee, coffee with milk, chocolate and chocolate with milk), which cost € 1.50, € 1.80, € 2.10 and € 2.40 respectively. The machine accepts 10, 20 and 50 cent coins, one (1) euro and two (2) euro coins, as well as € 5 and € 10 banknotes, and returns change using only coins. To implement a program, which:
a) To display a selection list (menu) of the offered items (numbered from 1 to 4) with the corresponding price for each, the option 0 to exit the program and then reads the user's choice (preferred item or exit), applying defensive programming to ensure that the user enters a value between 0 and 4.
Create a Python program to rename the Excel spreadsheets (found in the folder attached to this assignment) to add SCC in front of each file name. Save the newly named files in a new directory.
I can put the link in there for it
by CodeChum Admin
Instructions:
Input
The first line contains an integer n which is the size of the array.
The next n lines contains a string on each.
The last line contains an integer which is the index to be accessed and printed.
6
Learning
Programming
made
easy
with
Cody!
5Output
A line containing a string.
Cody!by CodeChum Admin
Instructions:
Input
Two lines containing a string.
fun
PythonOutput
A line containing a string.
Python is really funby CodeChum Admin
Instructions:
Output
The squares and cubes of the elements in the array.
4
1
1
8
27
.
.
.Zeller’s congruence is an algorithm developed by Christian Zeller to calculate the day of the week. The formula is
where: h=(q+²⁶(m+I)/10 + k/4 + i/4 + 5i)%7
• h is the day of the week (0: Saturday, 1: Sunday, 2: Monday, 3: Tuesday, 4: Wednesday, 5: Thursday, 6: Friday).
• q is the day of the month
• m is the month (3: March, 4: April, …, 12: December). January and February are counted as months 13 and 14 of the previous year.
• j is the century (i.e., Year/100).
• k is the year of the century (i.e., year%100)
Note that the division in the formula performs an integer division. Write a program that prompts the user to enter a year, month, and day of the month, and displays the name of the day of the
week. Here are some sample runs:
(Hint: January and February are counted as 13 and 14 in the formula, so you need to convert the user input 1 to 13 and 2 to 14 for the month and change the year to the previous year.)
Create a program that will accept number of students and number of quizzes of students. Based on this input the program will accept the name of the student and the quiz grades of the student. The input will be stored to a dictionary. The name of the student will be the key and the quizzes will be the value in list format (e.g., {“Jose S. Uy”: [87,90,97,80,95], “Rowena M. Evangelista”: [88,87,90,97,83].
The program will output the list of quizzes per student, the lowest quiz, the highest quiz, and the average quiz grade.
Write a program to calculate the average of
all scores entered between 0 and 100. Use a
sentinel-controlled loop variable to terminate the
loop. After values are entered and the average
calculated, test the average to determine whether
an A, B, C, D, or F should be recorded.
lat = [40.59, 40.52, 40.621, 40.519, 40.56, 41.265, 40.61, 40.806, 41.259, 41.265, 41.264, 41.264, 41.259, 41.262, 41.263]
lon = [69.532, 69.419, 69.354, 69.263, 69.478, 70.805, 69.706, 70.331, 70.815, 70.823, 70.815, 70.81, 70.824, 70.811, 70.811]The lat list indicates how far north and south Gracie the seal has traveled, and the long list represents how far east and west she has traveled. The larger the latitude value, the further north the seal was located, and for this area of the world, the larger the longitude value, the further west the seal is located.
Write a program to calculate the farthest in each direction that Gracie was located throughout her travels. Add four print statements to the lines of code above that output the following, where the number signs are replaced with the correct values from the correct list:
Farthest north = #
Farthest west = #
Farthest south = #
Farthest east = #