Question

Python Help Create a program that outputs a table from 1 to 5 using what you've...

Python Help

Create a program that outputs a table from 1 to 5 using what you've learned about "for" loops. Your program will print the number and indicate if the number is odd or even. If it is not odd you will multiply 2 numbers with it: number 1 and number 2. Your program must do the multiplication for only even numbers in the table. The output of your program should look like the figure below. Hint: Create a program using multiple "for loops". You will need a conditional statement to enter the second for loop and use a mathematical operator as well.

Example: My Odd and Even table 1 is an odd number 2 is even:   Multiplying it by 1 gives 2 Multiplying it by 2 gives 4 3 is an odd number 4 is even: Multiplying it by 1 gives 4 Multiplying it by 2 gives 8 5 is an odd number

0 0
Add a comment Improve this question Transcribed image text
Answer #1
print("My Odd and Even table")
for i in range(1, 6):
    if i % 2 == 1:
        print(i, "is an odd number")
    else:
        print(i, "is even:")
        print("   Multiplying it by 1 gives", i * 1)
        print("   Multiplying it by 2 gives", i * 2)




Add a comment
Know the answer?
Add Answer to:
Python Help Create a program that outputs a table from 1 to 5 using what you've...
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
  • PYTHON Description: Develop a Python program that asks for two positive integers, including zero and displays...

    PYTHON Description: Develop a Python program that asks for two positive integers, including zero and displays all the numbers generated using the Russian multiplication method. The Russian multiplication method consists in successively multiplying by 2 the multiplying and dividing (integer division) by 2 the multiplier until the multiplier takes the value 1. In the process, all the multiplicands corresponding to the odd multipliers are added. This sum is the product of the two numbers. The first integer will be the...

  • Using Python, Can someone please assist in the following: These are the hints: Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the...

    Using Python, Can someone please assist in the following: These are the hints: Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to display a warning if the number is less than 2 or greater than 10 and prompt the user to enter the data again until they enter a valid number Put a...

  • Question 1 - while .. else loop Write a Python program to create the multiplication table...

    Question 1 - while .. else loop Write a Python program to create the multiplication table (from 1 to 12) of a number that is given by the user. Example: User keyed in number 5 Output: Multiplication Table for 5 1 x 5 = 5 2 x 5 = 10 . . . 10 x 5 = 50 11 x 5 = 55 12 x 5 = 60

  • Need some help I am not understanding this programming class at all. We are using Microsoft...

    Need some help I am not understanding this programming class at all. We are using Microsoft visual studio with python in console mode to complete these labs. Double-click to hide white space CIS115 Week 4 Lab Overview Title of Lab: Multiplication Table in Python Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to...

  • python la ab X, X Lab 7 Design and implement a Python program that uses a...

    python la ab X, X Lab 7 Design and implement a Python program that uses a while loop and selection statements to print the sum of the even numbers and the sum of the odd numbers (all integers) read from the keyboard. The sequence of numbers ends with a negative number: So, all numbers considered for printing the two sums are greater than or equal to 0. The sequence may be empty. Here is a possible interaction. Enter an integer:...

  • Using MASM Please! Part 1: Call Mul from a procedure (50 pts) Create a procedure, and in that pro...

    Using MASM Please! Part 1: Call Mul from a procedure (50 pts) Create a procedure, and in that procedure multiply two numbers together using mul. Then call the procedure from the main procedure. Part 2: Do bitwise mulitiplication using only shift and add statements (30 pts) In your multiplication procedure multiply two numbers not using mul but by combining a fixed number of shift and add commands. For this part you only need to be able to handle 8 bit...

  • In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while...

    In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while loop or a for loop to print only odd numbers 1, 3, 5, 7, 9 *tip: you can use range () function, or a condition with ‘break’ (e.g, while count < 10) In python!: Create a program that print out 12 months of a year and associated numbers (e.g., January 1, February 2…). Two lists should be created, and then loop through the list...

  • C++ please no arrays! Create a program that will allow the user to enter up to...

    C++ please no arrays! Create a program that will allow the user to enter up to 50 whole values and determine the number of values entered, how many of the values were odd and how many of the values were even. Your code should contain 2 functions, a main function and a function to enter the numbers enter and count the values. Your main function should be a driver program that will call another function to count the total number...

  • Create A MultiplicationTable program using nested for loops which will display a multiplication table for the...

    Create A MultiplicationTable program using nested for loops which will display a multiplication table for the hexadecimal numbers 1 - F. Nested for Hint: if you use the System.out.printf method with a format specifier "%X" it will display an integer value in hexadecimal format.

  • In C++ The Multiplication Program Step 1: Write a program that stores a multiplication table in...

    In C++ The Multiplication Program Step 1: Write a program that stores a multiplication table in a 9-by-9 two-dimensional array. Generate the multiplication table with two loops. (So you will have a nested loop that will iterate 9 times and fill the 9x9 array with the values.) Step 2: Display the table for the user to see it. a 9x9 table Step 3: Create a function that returns the product of two numbers between 1 and 9by looking up the...

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