Question

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

  1. 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 to print about each month

  1. Create two lists that list each months of a year and 12 numbers to be associated with each month like below:

Months = [‘January’, ‘February’, ‘March’, ‘April’ ]

Numbers = [1, 2, 3, 4]

  1. Use a for loop to print each month of a year along with associated numbers (e.g., January 1, February 2…)

*tip: to add proper space between each month and number, you can use ‘\t’ along within print()

*tip: to deal with multiple lists in a for loop, you can use zip() and list the lists in it. (e.g., zip(months, numbers) )

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#Code1
for i in range(1,10,2):
    print(i)

#################

#Code2
Months = ["January","February","March","April","May","June","July","August","September","October","November","December"]
Numbers = [1,2,3,4,5,6,7,8,9,10,11,12]
for i in range(12):
    print(Months[i]+" "+str(Numbers[i]))
Add a comment
Know the answer?
Add Answer to:
In Python! Create the program that print out only odd numbers 1,3,5,7,9 Use either a while...
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
  • Write a python program that uses a while loop to print numbers 100,98,96... all the way...

    Write a python program that uses a while loop to print numbers 100,98,96... all the way to 0. each number should be printed on a seperate line

  • Write a python program where you create a list (you an create it in code you...

    Write a python program where you create a list (you an create it in code you do not have to use input() statements) that represents the total rainfall for each of 12 months (assume that element 0 is January and element 11 is December). The program should calculate and display the: 1) total rainfall for the year; 2) the average monthly rainfall; 3) the months with the highest and lowest amounts. You need to figure out how to access each...

  • Create a new Python program in IDLE, and save it as lab8.py.(Again, I recommend saving lab...

    Create a new Python program in IDLE, and save it as lab8.py.(Again, I recommend saving lab progranms Your Python program will do the following: Create an empty list . Use a for loop to ask the user for 10 numbers. Add each number to your list using the append metha . Use another for loop to print the list in reverse order, one per line . Use a while loop to count how many positive numbers are in the list...

  • Python Lists

    Write a program that asks the user for the number of the month they were born in (1 for January, 12 for December), then have the program print the name of the month and the birthstone for that month. Use two lists to store the names of the months and the names of the birthstones for each month, and use the number the user types to look up the values to print. Loop until an invalid month number is entered...

  • Write a Java program with a while statement that will only print out the numbers 50,...

    Write a Java program with a while statement that will only print out the numbers 50, 45, 40, 35, 30, 25.

  • Create a program that has 4 lists. One list has the title of 5 books. Another...

    Create a program that has 4 lists. One list has the title of 5 books. Another list has the price of the 5 books and another list has the quantity of the 5 books. Put all 3 lists into a Master List(the fourth list). Using a loop print out the Title of each book and the value of the inventory (quantity * price) # The book "100 Years of Solitude" has an inventory value of $568.78 # Use Python

  • Create a while loop that will execute the following code 12 times using a counter that...

    Create a while loop that will execute the following code 12 times using a counter that starts at 1 and is incremented by 1 each time through the loop. Within the while loop, create a switch statement that will print out the number of days in each of the months of the year. - Use fall through capabilities so that you only have one print statement for all of the months that contain 31 days. Do not worry about leap...

  • 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...

  • Write a Python program (using a nested loop) to print out the following pattern (there is...

    Write a Python program (using a nested loop) to print out the following pattern (there is a space between the numbers next to each other). 1 2 1 3 2 1 4 3 2 1 5 4 3 2 1

  • 1. Print out information of PHP use phpinfo() function. 2. Write a program that check and...

    1. Print out information of PHP use phpinfo() function. 2. Write a program that check and print odd / even numbers (from number 1 to 100 using for/while loop). Display the results within an HTML table with 2 columns as shown below: NUMBERS RESULTS 1 ODD 2 EVEN 3 ODD HINT: use <table> tags to create a table, <th> tags for ‘Numbers’ and ‘Results’. Wrap code PHP inside HTML code. For example: ​<html> ​​<title>CHECK ODD or EVEN</title> ​​<body> ​​​<table> ​​​​<?php...

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