1. tempA |execute the convert_temp function to convert the temperature 95 degrees Fahrenheit into degrees Celsius 2. tempB | execute convert_temp to convert the temperature 17 degrees Celsius into degrees Fahrenheit
Q: 3. Tree traversal is the process of visiting each node in a tree data structure. Tree traversal also…
A: python program to build/insert ino binary search tree and performing pre order traversal of the…
Q: 2 Tuples. Create a tuple containing the names of five countries and display the whole tuple. Ask the…
A: Step-1: Start Step-2: Declare a tuple countries with values ('Albania', 'Uzbekistan', 'Romania',…
Q: This code is for Python
A: Note: The below program has been complied and executed in "repl.it" online complierThe screenshot…
Q: Finclude nt main() printf("--- printf("Formula Race Ticket Reservation System\n"); printf("- -\n");…
A: print("--------------------------------------")print("Formula Race Ticket Reservation…
Q: The file SARS-CoV-2.fasta contains five genomes of SARS-CoV-2: the ancestor (Wuhan, the first…
A: Here is Python code to read the sequences from the SARS-CoV-2.fasta file: sequences = {} with…
Q: Prompt the user for 10 data entries as Names, another 10 as weights corresponding to the names,…
A: Code: (change 3 in for loop to 10 to take 10 values) def bmr(h,w): return((int((h/w)*100))/100)…
Q: Modify this chapter's case study program (the c-curve) so that it draws the line segments using…
A: Python:- Python is mostly used for machine learning Python is also used for scripting It is easy to…
Q: Exercise 7: y = x"(= en In x) Write a function power() (not using math.pow()) • takes 2 numbers as…
A: Algorithm Steps:- 1. Even though the exponent can be calculated in Python using the inbuilt **…
Q: def foo(num): if (num<=0): return else: print(num/2,end=" ") foo(int(num/2)) print(num/2,end=" ")
A: To do: Output of the given code
Q: USE PYTHON THANKS
A: Coded using Python 3.
Q: In the cell below, there is a function that is not operating as anticipated. count_consonants is…
A: def Check_Vow(string): # casefold has been used to ignore cases string = string.casefold()…
Q: Deletion is the operation which we apply on all the data-structures. Deletion means to delete an…
A:
Q: Exercise 6: Area of a Circular Sector Write a function area_of_circular_sector() which • takes 2…
A: In this program question using python We have to calculate area of circular sector using two…
Q: Program # 2 function fl else plot the function /2. If either x or y is zero, ask user to enter…
A: # Import the required libraries import math import matplotlib.pyplot as plt # Input two numbers x =…
Q: Write a program to find all even numbers between 100 and 400. The number obtained should be printed…
A: A program to find all even numbers between 100 and 400.the number printed in comma separated…
Q: Write a function called random_sent (source_file, length) that takes in two parameters: source_file…
A: According to the information given:- We have to follow the instruction in order to get desired…
Q: Create a program that reads the text file called "data.txt". Column O contains the patient number…
A: NumPy is the python built-in package that has the functions to create an array and multidimensional…
Q: Suppose that we removed the line labeled #11, that is the call to Foo. __init_ from within Bar.…
A: The given below program is in python with the as it is given with some few changes.
Q: Write Python function to generate prime numbers. def gen_prime(n): Ist = gen_prime(10) print(Ist)…
A: 1) Algorithm of the code:- 1. Start 2. Initialize an empty list, prime_list. 3. Set num = 2. 4.…
Q: 4. An n by n matrix defines a linear transformation (function) on n-dimensional vectors. a12 ain ...…
A: - We need to perform dot product of the matrix in python.
Q: he nth Fibonacci Number can be calculated using the following formula: V5 2 reate a function with…
A: import math # calculate nth Fibonacci numberdef fib(int1): sqrt5 = math.sqrt(5) # ((1 + V5)/2)^n…
Q: Problem 1 Write a program called p1.py with the following functions: 1. the function factorial_loop…
A: Given: To write a python code.
Q: 3. Rewrite the following code segment using a multiple-selection statement in the following…
A: Hello student Greetings Hope you are doing great. Thank you!!! All different language…
Q: 2. Implement the following function in the PyDev module functions.py and test it from a PyDev module…
A: Program Approach: Step 1: Import the math module for the pi value. Step 2: Create a function…
Q: Please write the code in Python
A: As per the requirement program is completed. Note: In python indentation is very important. Please…
Q: Average Restaurant Rating and Number of Stars-A restaurant receives numeric scores of 0-10 from five…
A: Python program to solve the given problem is below.
Q: Generate a class called CourtJester(). This object should inherit all attributes and methods from…
A: The question asks designing the 2 classes named Kingdom and CourtJester as described. The class…
Q: Answer this question in python write code and output must
A: Python used to answer this question
Q: Use the list n = [34, 24, 14, 'eleven', 21, 31, 41] to answer the following question: What would be…
A: We are given a question on python , which uses index property of python list. We will find out what…
Q: Write a function calculate_points that has a single input parameter: hand . hand can be assumed to…
A: Python function: #function to calculate the point on a hand def calculate_points (hand): #set…
Q: Task 3: In this problem set we want to make the real-world images look like they are genuinely from…
A: In This program We are going to learn images filtering and how we can turn a images into cartoons…
Q: In this problem, you will be given a list of numbers. You have to sort the list using the Merge Sort…
A: Program Approach The merge function takes two sorted lists a and b as input and returns a single…
Q: Write a Python program using List Methods and Functions to do the following a. Create an empty list…
A: To insert an element into list at specific index, we have to use insert method For concatenation, we…
Q: det generate_lottery_numbers(): *** Generates a list of 5 random integers between 1 and 42,…
A: Here our task is to complete the python program to stimulate a lottery playing environment by…
Answer the following question using Python
Please find the answer below :
Step by step
Solved in 2 steps with 4 images
- Create a function named fnTuition that calculates the tuition for a student. This function accepts one parameter, the student ID, and it calls the fnStudentUnits function that you created in task 2. The tuition value for the student calculated according to the following pseudocode: if (student does not exist) or (student units = 0) tuition = 0 else if (student units >= 9) tuition = (full time cost) + (student units) * (per unit cost) else tuition = (part time cost) + (student units) * (per unit cost) Retrieve values of FullTimeCost, PartTimeCost, and PerUnitCost from table Tuition. If there is no student with the ID passed to the function, the function should return -1. Code two tests: 1) a student who has < 9 student units, and 2) for a student who has >= 9 student units. For each test, display StudentID and the result returned by the function. Also, run supportive SELECT query or queries that prove the results to be correct.Please complete the exercise as instructed and do not use global variables. Please follow the guidelines of what the solution cannot use provided in the second picture. Thank you!There is only 1 ques with 2 part. Please answer the questions ( Answer in python ) Part I: Cities. Write a function called describe_city which accepts the name of a city and its country. The function should print a simple sentence as shown in the output example. Give the parameter for the country a default value. Make 5 calls to the function using the following arguments: Reykjavik, Iceland Pittsburg Ontario, Canada Cairo, Egypt Miami, USA Output Example : ( FOLLOW THE OUTPUT SAME AS GIVEN BELOW ) Reykjavik is in Iceland Pittsburg is in USA Ontario is in Canada Cairo is in Egypt Miami is in USA Part II: Blastoff!!! Write a function called count_down which has 1 integer parameter. The function should countdown from that parameter value to 1. Each step in the countdown should be printed on the same line followed by ‘Blastoff!!!’ also on the same line. All of this should happen in the function. Make 3 calls to the function with the following arguments: 3 5 10 Output…
- We want to develop a game where the user should guess a secret number. The game asks the user to input a number and tells how close it is to the secret random number that the game generates. Complete the main() function that implements this game by calling the get_user_input(), generate_secret(), and display_result(user_input, secret) functions that you will develop as follows: • Complete the get_user_input() function so that it prompts the user to enter a whole number between 1 and 20 (inclusive) and returns the number that the user enters. • Complete the generate_secret() function so that it generates and returns a random number between 1 and 20 (inclusive). • Complete the display_result(user_input, secret) function that takes the two parameters that correspond to the user input and the secret. It should then print the absolute difference between these two numbers. For example: Test Input Result random.seed (10) S Enter a number from 1 to 2015 You entered 5. The secret was 19. The…We want to develop a game where the user should guess a secret number. The game asks the user to input a number and tells how close it is to the secret random number that the game generates. Complete the main() function that implements this game by calling the get_user_input(), generate_secret(), and display_result(user_input, secret) functions that you will develop as follows: • Complete the get_user_input() function so that it prompts the user to enter a whole number between 1 and 20 (inclusive) and returns the number that the user enters. • Complete the generate_secret() function so that it generates and returns a random number between 1 and 20 (inclusive). Complete the display_result(user_input, secret) function that takes the two parameters that correspond to the user input and the secret. It should then print the absolute difference between these two numbers. For example: Test Input Result random.seed (10) 5 random.seed(50) 6 Enter a number from 1 to 2015 You entered 5. The…In this coding challenge, you will be retrieving email usernames from a string. You will write a function named get_usernames () that takes in a string as it's input parameter, and returns a list of email usernames in the string. The input strings will contain 0 or more emails in the format and the '@' symbol will only appear in the context of an email. The order of usernames should match the order in the input text. username@domainname, For example: EXAMPLE 1 text: "If you need help on an assignment, email help@ucsd.edu or support@gmail.com" return: ['help', 'support'] EXAMPLE 2 text: "Good morning! I hope you're having a great time with CSE 8A!" return: [] EXAMPLE 3 text: "I've been having a lot of trouble reaching you, can you please email me at cse@ucsd.edu? return: ['cse', 'cse'] Here is the problem description: Function Name: get_usernames Parameter: text - A string corresponding to a piece of text containing 0 or more emails. Return: A list of the email usernames in the input…
- Write a set of functions that calculate the cost of movie tickets for a family. These functions should use a pass-by-reference variable that accesses the double running_total variable in main(). Using a loop, keep displaying the ticket prices for each age group: Something like: Model Hall Movie Ticket Box Office Under Age 3 (free) Ages 3-11 ($10.25) Ages 12-54 ($15.50) Age 55 or older ($12) If 4 tickets are purchased (not counting under age 3) then 20% discount Within the loop: Keep asking the user to input the moviegoer age and to enter a zero for the age when they are finished inputting all the family members. Also, within the loop: Keep a running_total that is output to the screenafter each age has been entered. This running_total should be accessed through the functions using apass-by-reference variable. Finally, after the looping is done: Calculate the total cost, including a 7.5% sales tax, and output it to the screen.Program in c++ languageIn physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving object’s kinetic energy:KE=12mv2The variables in the formula are as follows: KE is the kinetic energy, m is the object’s mass in kilograms, and v is the object’s velocity in meters per second. Write a function named kinetic_energy that accepts an object’s mass (in kilograms) and velocity (in meters per second) as arguments. The function should return the amount of kinetic energy that the object has. Write a program that asks the user to enter values for mass andvelocity, then calls the kinetic_energy function to get the object’s kinetic energy.
- Write the function truck_adjustment_factor(truck_proportion, terrain_type) that takes the proportion of trucks using the motorway and the terrain type as inputs and returns the adjustment factor that is used for calculating the highway capacity. The adjustment factor is calculated according to the following formula: adju stment factor = tprupurtime x(furtor-1) Where proportion is the proportion of trucks and the factor is the car equivalent factor for the given terrain. You should be calling your car_equivalent_factor function to get the factor - don't reinvent the wheel! For example, for rolling terrain and a truck proportion equal to 0.12: adjustment factor = 1/(1 + 0.12 x (4.0 - 1)) = 0.735 Notes: You should include (and call/use) your car_equivalent_factor function in your answer o In general, you should paste in your whole module so far in each question as later functions will call earlier functions. • You can assume the function will always be called with one of the three valid…Using Python, write an application that will calculate a loan payment. To complete this, you are required to write 2 functions, LoanPayment and InterestOnlyLoanPayment, as well as a test application that calls each of the functions to get the payment amount based on parameters supplied to the functions. The test application should output both the loan payment and the interest-only loan payment based on input values from the user. The LoanPayment function is defined as follows: Payment = Loan amount / Discount factor The discount factor is {[(1 + i)^n] - 1} / [i(1 + i)^n], where you have the following: n = Payments per year × Number of years i = Annual interest rate / Payments per year Take for example the following: D = {[(1 + 0.005)^360] – 1} / [0.005(1 + 0.005)^360] = 166.7916, where n = 12 × 30 and i = 0.06 / 12. Loan payment = $250,000 / 166.7916 = $1,498.88 The InterestOnlyLoanPayment is defined as follows: Interest-only payment = Loan amount × (Annual interest rate / 12) Take…this one too please Can data members be passed to a function using the object? If yes, explain.