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,...
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...
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
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 beginner level PYTHON code! Your job is to write a Python program that...
Please write in beginner level PYTHON code! Your job is to write a Python program that asks the user to make one of two choices: destruct or construct. - If the user chooses to destruct, prompt them for an alternade, and then output the 2 words from that alternade. - If the user chooses construct, prompt them for 2 words, and then output the alternade that would have produced those words. - You must enforce that the users enter real...
Important: please use python. Using while loop, write python code to print the times table (from...
Important: please use python. Using while loop, write python code to print the times table (from 0 to 20, incremented by 2) for number 5. Add asterisks (****) so the output looks exactly as shown below.   Please send the code and the output of the program. ****************************************************************** This Program Shows Times Table for Number 5 (from 0 to 20) Incremented by 2 * ****************************************************************** 0 x 5 = 0 2 x 5 = 10 4 x 5 = 20 6...
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
Write a python script to solve the 4-queens problem using. The code should allow for random...
Write a python script to solve the 4-queens problem using. The code should allow for random starting, and for placed starting. "The 4-Queens Problem[1] consists in placing four queens on a 4 x 4 chessboard so that no two queens can capture each other. That is, no two queens are allowed to be placed on the same row, the same column or the same diagonal." Display the iterations until the final solution Hill Climbing (your choice of variant)
Write a code for simple racing game (using dots) on c coding.
Write a code for simple racing game (using dots) on c coding.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT