Question

In: Computer Science

Using python as the coding language please write the code for the following problem. Write a...

Using python as the coding language please write the code for the following problem.

Write a function called provenance that takes two string arguments and returns another string depending on the values of the arguments according to the table below. This function is based on the geologic practice of determining the distance of a sedimentary rock from the source of its component grains by grain size and smoothness.

First Argument Value

Second Argument Value

Return Value

"coarse"

"rounded"

"intermediate"

"coarse"

"angular"

"nearby"

"medium"

"rounded"

"intermediate"

"medium"

"angular"

"intermediate"

"fine"

"rounded"

"intermediate"

"fine"

"angular"

"far"

Solutions

Expert Solution

Please find the Python code for the following:

Code:

#Defined a function called provenance that takes two string arguments
#and returns another string depending on the values
def provenance(argument1,argument2):
  
#Using an if-else ladder, we are checking both the string arguments
#Then returning the string based on the table return values
  
if argument1=="coarse" and argument2=="rounded":
return "intermediate"
  
elif argument1=="coarse" and argument2=="angular":
return "nearby"

elif argument1=="medium" and argument2=="rounded":
return "intermediate"

elif argument1=="medium" and argument2=="angular":
return "intermediate"

elif argument1=="fine" and argument2=="rounded":
return "intermediate"
  
elif argument1=="fine" and argument2=="angular":
return "far"

Please check the compiled program and its output for your reference:

Output:

(Feel free to drop me a comment, If you need any help)


Hope this Helps!!!
Please upvote as well, If you got the answer?
If not please comment, I will Help you with that...


Related Solutions

In python please write the following code the problem. Write a function called play_round that simulates...
In python please write the following code the problem. Write a function called play_round that simulates two people drawing cards and comparing their values. High card wins. In the case of a tie, draw more cards. Repeat until someone wins the round. The function has two parameters: the name of player 1 and the name of player 2. It returns a string with format '<winning player name> wins!'. For instance, if the winning player is named Rocket, return 'Rocket wins!'.
Write a code to find the following in a text file (Letter). language: Python (a) Find...
Write a code to find the following in a text file (Letter). language: Python (a) Find the 20 most common words (b) How many unique words are used? (c) How many words are used at least 5 times? (d) Write the 200 most common words, and their counts, to a file. text file: Look in thy glass and tell the face thou viewest, Now is the time that face should form another, Whose fresh repair if now thou not renewest,...
Using Python programming language, write a LONG piece of code that utilizes the do while function...
Using Python programming language, write a LONG piece of code that utilizes the do while function and the switch statement, please do not make It short, thank you.
Please write code for C language Problem: Write a couple of functions to process arrays. Note...
Please write code for C language Problem: Write a couple of functions to process arrays. Note that from the description of the function you have to identify what would be the return type and what would be part of the parameter. display(): The function takes an int array and it’s size and prints the data in the array. sumArray(): It takes an int array and size, and returns the sum of the elements of the array. findMax(): It takes an...
For this problem you should describe the algorithm using a flowchart and then write Python code...
For this problem you should describe the algorithm using a flowchart and then write Python code to implement the algorithm. You are to create a Python program file for your code. Include in your HW document a photo of your flowchart and a screenshot of your program file and the output in IDLE that results when you run the program. The algorithm: Ask the user to input their annual salary and then calculate and print the weekly salary (annual/52). I...
Objective: Using Java coding language, complete each "TO-DO" section for the following classes. Shape code (for...
Objective: Using Java coding language, complete each "TO-DO" section for the following classes. Shape code (for reference, nothing to complete here): import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; import java.io.RandomAccessFile; public abstract class Shape extends Rectangle {    public int id;    public Color color;    public int xSpeed, ySpeed;       public Shape(int id, int x, int y, int width, int height, Color color, int xSpeed, int ySpeed) {        super(x,y,width,height);        this.id = id;        this.color...
Please write in Python code Write a program that stores the following data in a tuple:...
Please write in Python code Write a program that stores the following data in a tuple: 54,76,32,14,29,12,64,97,50,86,43,12 The program needs to display a menu to the user, with the following 4 options: 1 – Display minimum 2 – Display maximum 3 – Display total 4 – Display average 5 – Quit Make your program loop back to this menu until the user chooses option 5. Write code for all 4 other menu choices
Please solve using simple python programming language and make it easy to understand explain your code...
Please solve using simple python programming language and make it easy to understand explain your code as I am a beginner, use appropriate variable names which make the code easy to understand and edit if needed. A subsystem responsible for delivering priority numbers to an automated irrigation system has stopped working and you need to deliver a quick fix that will work until the actual subsystem is fixed by senior developer. As you are the newest addition to the development...
Using the python program language. Expand/EDIT the code below for all vowels (AEIOU). Please provide a...
Using the python program language. Expand/EDIT the code below for all vowels (AEIOU). Please provide a code and a screen shot of the code working with an output. the code should be able to take any name as an  input. The code should be able to pull out the vowels along with the count fo each vowel within that name for the output. #countVowels.py import sys s1 = str(sys.argv[1]) (a,e,i,o,u) = (0,0,0,0,0) print ("String length = ", len(s1)) for n in...
Please answer with code for C language Problem: Counting Numbers Write a program that keeps taking...
Please answer with code for C language Problem: Counting Numbers Write a program that keeps taking integers until the user enters -100. In the end, the program should display the count of positive, negative (excluding that -100) and zeros entered. Sample Input/Output 1: Input the number: 0 2 3 -9 -6 -4 -100 Number of positive numbers: 2 Number of Negative numbers: 3 Number of Zero: 1
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT