Question

In: Computer Science

Can you please write this in python thank you. Consider 'x' being a number chosen by...

Can you please write this in python thank you.

Consider 'x' being a number chosen by a user. Using python conditional statements, write a code that:

  • prints "x is a multiple of 3 and 5" if x is dividable by both numbers 3 and 5
  • prints "x is a multiple of 7 or 11" if x is dividable be either numbers 7 or 11.

Solutions

Expert Solution


x=int(input("Enter a number: "))
if(x%3==0 and x%5==0):
    print(x,"is a multiple of 3 and 5")
elif(x%7==0 or x%11==0):
    print(x,"is a multiple of 7 or 11")
else:
    #please undo the below comment to get a output which doesnt comes under the above conditions
    #print("Not a multiple of 3,5,7,11")
    print("")

Output:

NOTE: In the above question, there is no print statement given for the number that doesnt fall under either of the conditions. so comments are given if you want an answer, please remove comments from ' else' statement to get output for such numbers.


Related Solutions

can you paraphrase this please!! thank you! "The students have fixed number of hours in a...
can you paraphrase this please!! thank you! "The students have fixed number of hours in a week to choose between studying and working, it is completely incorrect in saying that whether it is the study that causes work or work causes study. It is generally assumed that students always choose total hours as a mix of studying and working depending on their rational behavior. This would help them maximizing their utility subject to the constraint of limited fixed hours in...
Please write a basic function using Python. Please comment all steps. Thank you! Experimentally determined molecular...
Please write a basic function using Python. Please comment all steps. Thank you! Experimentally determined molecular structures are stored in the Protein Data Bank. Protein Data Bank format is a standard for files containing atomic coordinates which are stored in the “ATOM” record. Write a Python function to extract x coordinate of each atom for a given PDB file. Test your function with the provided “1a3d.pdb” file as the example. Also, give a good thought what would be the proper...
Can you please write this in python and comment as well so I can understand what...
Can you please write this in python and comment as well so I can understand what yo are doing. Thank you. 1)Loop through list A, at each iteration, show the square root result of that element. Add proper text to your print function. A = [-4, 1, -16, 36, -49, 64, -128] 2)Create a counter variable, name it i and initialize it to 0. Using a for loop, count how many numbers are divisible by 3 in range of 1...
USING PYTHON. Thank you in advance Write a program that allows the user to enter a...
USING PYTHON. Thank you in advance Write a program that allows the user to enter a series of string values into a list. When the user enters the string ‘done’, stop prompting for values. Once the user is done entering strings, create a new list containing a palindrome by combining the original list with the content of the original list in a reversed order. Sample interaction: Enter string: My Enter string: name Enter string: is Enter string: Sue Enter string:...
Python program. Write a python program that can convert any radix-d (arbitrary base) number to the...
Python program. Write a python program that can convert any radix-d (arbitrary base) number to the equivalent radix-e (another arbitrary base) number. Where e and d are members in [2, 16]. Remember, base 16 needs to be calculated as hexadecimal. So, if radix-d is input as a hexadecimal number, it needs to convert and output to desired base. Conversely, if base 16 is the desired output, then the output needs to show a hexadecimal number. Hints: The easiest approach is...
using python: Given an arbitrary whole number, please write an if statement to output if it...
using python: Given an arbitrary whole number, please write an if statement to output if it is an even number or an odd number
PLEASE USE PYTHON THANK YOU In the game of Lucky Sevens, the player rolls a pair...
PLEASE USE PYTHON THANK YOU In the game of Lucky Sevens, the player rolls a pair of dice. If the dots add up to 7, the player wins $4; otherwise, the player loses $1. Suppose that, to entice the gullible, a casino tells players that there are many ways to win: (1, 6), (2, 5), and soon. A little mathematical analysis reveals that there are not enough ways to win to make the game worthwhile; however, because many people's eyes...
Please do this code with python. Thank you! struct Node {     int data;     struct...
Please do this code with python. Thank you! struct Node {     int data;     struct Node* left;     struct Node* right; }; // Node creation struct Node* newNode(int data) {     struct Node* nn         = new Node;     nn->data = data;     nn->left = NULL;     nn->right = NULL;     return nn; } // Function to insert data in BST struct Node* insert(struct Node* root, int data) {   if (root == NULL)         return newNode(data);     else {...
Can you please just answer part 2! Thank you 1. Suppose x(t) is a square wave...
Can you please just answer part 2! Thank you 1. Suppose x(t) is a square wave of fundamental frequency 1000 rad/s. It gets processed by an ideal low-pass filter with cut-off frequency 1200 rad/s. Sketch the output of this filter, y(t). Suppose we want to process y(t) digitally and be able to fully reconstruct it. What is the minimum necessary sampling frequency to do so? 2. Suppose we wish to digitally process and fully reconstruct the same x(t) from before....
you didn't mention the page number for question 2? please put the page number. Thank you...
you didn't mention the page number for question 2? please put the page number. Thank you so much! you can find the page number Reflect relate an introduction interprete communication textbook. please.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT