Question

I need help correcting syntax with this python code function multiplyItAgain(x, y) retrn x * y...

I need help correcting syntax with this python code

function multiplyItAgain(x, y) retrn x * y a = Python is great! /* set variable to 10 */ int b = 3 /* run a computation */ c = multiplyIt(a; b) System.out.println(c) /* run another computation */ c = multiplyIt(3; b) System.out.println(c)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def multiplyIt(x, y):
    return x * y


a = 'Python is great!'
b = 3
c = multiplyIt(a, b)
print(c)
c = multiplyIt(3, b)
print(c)
Add a comment
Know the answer?
Add Answer to:
I need help correcting syntax with this python code function multiplyItAgain(x, y) retrn x * y...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I'm trying to run the code in Python below and keep getting invalid syntax. What's wrong?...

    I'm trying to run the code in Python below and keep getting invalid syntax. What's wrong? Thanks for any help! def even(n): if n%2==0 #Enter a Number def main(): n=int(input("Enter a number: ")) #If even print "Number is even" if(even(n)): print("The number is even") #If odd print "Number is odd" else: print("The number is odd") main() #Call the main function

  • 1. Questions Python Code: For each line of code, write the type of error (syntax, semantics,...

    1. Questions Python Code: For each line of code, write the type of error (syntax, semantics, runt-time), cause of the error, and your fix. (1) def fun(num letter) (2) num == 7 + num (3) return 'num' - letter (4) result = fun(5, x) 2. Question Python Code: Run the code below to check the outputs of the print() call on lines 12. And : A) Analyze the application of the accumulation pattern and answer the following questions: #1. a....

  • I need help modifying this python code: a) I need to take 2 attributes of the...

    I need help modifying this python code: a) I need to take 2 attributes of the data as int - (columns (3 & 5) of my data) b) I need to take 2 more attributes as floats -(columns 4&6 of my data) c) I need to take 1 attribute as string (column 16 of my data) How would I modify this code # # Initial version - "standard programming" # # Define a list for the data. The data structure...

  • The files provided in the code editor to the right contain syntax and/or logic errors. In...

    The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. // Prompt user for value to start // Value must be between 1 and 20 inclusive // At command line, count down to blastoff // With a brief pause between each displayed value import java.util.*; public class DebugSix3 { public static void...

  • Write a function in python that takes a set A and a relation R(x, y) on...

    Write a function in python that takes a set A and a relation R(x, y) on A (as a python function such that R(x, y) returns true if and only if the relation xRy holds), and returns True if and only if the relation R is reflexive. Here is the function signature you need to use. def is reflexive(A, R): You can test your code as follows. s = {1,2,3} def y(x, y): return x == y def n(x, y):...

  • I need help writing a very basic code in python. The code should not be very...

    I need help writing a very basic code in python. The code should not be very complicated. The code must have the following things in it: 1. create a function that takes a state and length of characters and makes a license plate and use the function to make a plate based on user input (use the def function and random.choice as well as import random) 2. the license plate should be a mix of random letters and numbers based...

  • THIS IS THE CODE I AM TRYING TO RUN code # def main():       #Reading a as...

    THIS IS THE CODE I AM TRYING TO RUN code # def main():       #Reading a as an integer       a = int(input("Enter value for a: "))       #reading b as an interger       b = int(input("Enter value for b: "))       #reading n as an integer       n = int(input("Enter value for n: "))       # displaying if a and b are congruent modulo n, this is True if a and b       #both returns same remainder when divided by n       if a % n == b...

  • I need to rewrite this code without using lambda function using python. def three_x_y_at_one(x): result =...

    I need to rewrite this code without using lambda function using python. def three_x_y_at_one(x): result = (3 * x *1) return result three_x_y_at_one(3) # 9 zero_to_four = list(range(0, 5)) def y_values_for_at_one(x_values): return list(map(lambda x : three_x_y_at_one(x), x_values)) -------> this is the function that I need to rewrite without using a lambda function . y_values_for_at_one(zero_to_four) # [0, 3, 6, 9, 12] Thanks

  • This is a java code but I need to understand the logic of how is going...

    This is a java code but I need to understand the logic of how is going to run. Can someone help please. int i = 1; while (i <= 5) { xMethod(i); i++; } System.out.println("i is " + i); } public static void xMethod(int i) { do { if (i % 2 != 0) System.out.print(i + " "); i--; } while (i >= 1); System.out.println();

  • I need this code to be written in Python: Given a dataset, D, which consists of...

    I need this code to be written in Python: Given a dataset, D, which consists of (x,y) pairs, and a list of cluster assignments, C, write a function centroids(D, C) that computes the new (x,y) centroid for each cluster. Your function should return a list of the new cluster centroids, with each centroid represented as a list of x, y: def centroid(D, C):

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT