Python Assignment:
Print a list of four animals. Number the list without using the numbers 1,2,3,4. Use only the number 9 in your program to print 1,2,3,4.
Example Output:
Four cool animals:
1 donkey 2 monkey 3 lion 4 turkey
Thanks for Asking!
There can be multiple solutions to this:
Either we can directly print the list and numbers or a better way is by using these two lists:
One for numbering and One for names of animals.
a=["donkey","monkey","dog","turkey"]
b=[9/9 , 9/9+9/9 , 9/9+9/9+9/9, 9/9+9/9+9/9+9/9 ]
for i,j in zip(b,a):
print(int(i),j)
Output:

Hope you like it!
Sure! Here's an example program in Python that prints a list of four animals using the number 9 to represent the numbers 1, 2, 3, and 4:
pythonCopy codeanimals = ['Lion', 'Elephant', 'Tiger', 'Giraffe']for i, animal in enumerate(animals): print('Animal', i + 9, ':', animal)Output:
yamlCopy codeAnimal 9 : LionAnimal 10 : ElephantAnimal 11 : TigerAnimal 12 : Giraffe
In this program, the enumerate() function is used to iterate over the animals list and retrieve both the index (i) and the animal name (animal). The index is then incremented by 9 to represent the numbers 1, 2, 3, and 4. The program prints each animal along with its corresponding number.
Python Assignment: Print a list of four animals. Number the list without using the numbers 1,2,3,4....
Please Use Python Check the example codes of prompting the user for a list of numbers and prints out the maximum and minimum of the numbers at the end when the user enters “done”. Write the program to store the numbers the user enters in a list and use proper Python build-in functions or loops to compute the maximum and minimum numbers after the loop completes. Example output: Enter a number: 6 Enter a number: 2 Enter a number: 9...
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...
Define a function that creates a list of all the numbers that are factors of the user's number. For example, if the function is called factor, factor(36) should return [1, 2, 3, 4, 6, 9, 12, 18, 36]. The numbers in your list should be sorted from least to greatest, and 1 and the original number should be included. Remember to consider negative numbers as well as 0. Bonus: Have the program print the factors of the users number in...
Hello! I'm looking for help with this assignment. Complete a program in pseudocode and Python that performs the following tasks. Open the file called M4Lab1ii.py linked below these instructions in your M4 Content module in IDLE. Save as M4Lab1ii.py. Replace ii with your initials. [example for someone with the initials cc: M4Lab1cc.py] Complete Steps 1-7 as requested within the code’s comments. Run your program and test all four calculations, then exit the program. Save your program as M4Lab1ii.py using your...
python language
Problem Description: In this program we are going to explore a list or an array of integers using Python. Your program should read a set of integers from the user and store them in a list. Read numbers from the user until the user enters 0 to quit. Then store them in a list. Your program should them compute the sum of all the numbers in the list and output to the user. You will use lists and...
Python HELP How can a get the diagonals of an n x n list without using numpy. For example if have a list: L = [[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Then I can get the diagonals: 1, 6, 11, 16 2, 7 , 12 3, 8 5 , 10 ,15 9, 14 2, 5 3, 6, 9 4, 7, 10, 13 8, 11, 14 12,...
Python HELP How can a get the diagonals of an n x n list without using numpy. For example if have a list: L = [[1,2,3,4], [5,6,7,8], [9,10,11,12], [13,14,15,16] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Then I can get the diagonals: 1, 6, 11, 16 2, 7 , 12 3, 8 5 , 10 ,15 9, 14 2, 5 3, 6, 9 4, 7, 10, 13 8, 11, 14 12,...
CPT 180 Chapter 2 Assignment 3 Directions Using the following guidelines, create a python program. 1. Create a program named printRandomNumbers that gets input from the user and then produces a list of random numbers. 2. Import the random module 3. Add three comment lines at the top of the program that contain: a. Program Name b. Program Description c. Programmer's Name (You) 4. Prompt the user for the following: a. Number of random numbers required b. Lower limit of...
python
In a program, write a function that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display the number n, the list of numbers, and a sub list of all the numbers in the list that are greater than the number n. Initialize the list and the number n in the main function of your code and call your function, passing the list and number as arguments. Run your code...
Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...