Question

please write these as you would into python. . i will give an thumbs ups 1....

please write these as you would into python. . i will give an thumbs ups

1.
Evaluate the following expressions using Python
1. Product of first 10 even integers.
2. Midterm scores of 4 students are 89, 78, 90, 98. Find the average of these scores.
3. Evaluate 3 to the power 7
4. Find the number of foot in 345 inches.
5. find the remainder when 34567 divides by 17.

2. animals = ['cat', 'dog', 'lion', 'tiger', 'monkey', 'hyena']

1. print the list
2. check if cat appears in the list.
3. add 'wolf' and 'bison' to the list.
4. find the index of monkey.
5. sort the list
6. remove 'hyena' from the list.
7. find the new length of the list.
8. pop an element from the list.
9. append 'cow' to the list
10. make sure that 'buffalo' does not appear in the list.
11. make 2 copies of the list.

3. numbers = [3456, 7865, 2341, 8907, 6798, 4576, 1098, 4320, 8905, 7812, 6453, 2341, 1994]

1. find the min of the list.
2. find the max of the list.
3. add 8654 to the list two times.
4. find the index of 7812.
5. append 1257 to the list.
6. Count the occurances of 2341 in the list.
7. find the sum of the list.
8. find the length of the list.
9. does 4321 appear in the list?
10. remove 1994 from the list.
11. pop an element from the list
12. Print new length of the list.
13. sort and print the sorted list.
14. reverse and print the list.

4. s = 'python programming'
Write the boolean expressions to test the following

1. last character of the string is 'g'
2. third character of the string is 't'
3. first and last characters are equal.
4. The 7th character of the string is ' '.
5. The substring 'prog' appears in s.
6. 'mm' appears in s.
7. the string ends in 'tion'
8. The string starts with 'py'

5. Assign variable a with 4, b with 3 and c with 5. check if a**2 + b**2 equals c**2.
6. Assign variable r with 5. Find the value of area and circumference of circle with radius 5.
7. Assign the variable first with value of first name and last with ast name. Print them in order of first, last and last, first.

8. Evaluate following boolean expressions
1. -15 < -9
2. 15 == 15.0
3. -8 + 8 == 0
4. 45//9 == 5
5. math.sqrt(25) == 5.0
6. 4**2 <= 15
7. 3**3 == 9
8. 6 - 7 >= 0
9. 34%4 == 4
10. -3**2 == -9

9. birds = ['crow', 'peacock', 'sparrow', 'dove', 'eagle', 'parrot', 'finch']
create the following sublists
1. sublist containing first three elements of birds.
2. sublist containing last two elements of birds.
3. sublist containing peacock, sparrow, dove.
4. sublist containing dove, eagle.
5. sublist containing eagle, parrot.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

1)print(2*4*6*8*10*12*14*16*18*20.)

2)avg=(89+78+90+98)/4
3)print(3**7)
4)1_in=0.0833333333
foot=365*1_in
print(foot)
5)print(34567%17)

2)

animals = ['cat', 'dog', 'lion', 'tiger', 'monkey', 'hyena']
1)print(animals)
2)print('cat' in animals)
animals.append('wolf')
3)animals.append('bison')
print(animals)
4)animals.sort()
5)animals.remove("hyena")
6)print(len(animals))
animals.append('cow')
7)print(animals)
8)animals1=animals
print(animals1)

3)

numbers = [3456, 7865, 2341, 8907, 6798, 4576, 1098, 4320, 8905, 7812, 6453, 2341, 1994]
1)min(numbers)
2)max(numbers)
3)numbers.add(8654)
4)numbers.indexOf(7812)
5)numbers.append(1257)
6)numbers.count(2341)
7)sum(numbers)
8)len(numbers)
9)4321 in numbers
10)numbers.remove(4321)
11)numbers.pop()
12)len(numbers)
13)numbers.sort()
   print(numbers)
14)numbers.reverse()
   print(numbers)

4)

s="python programming"
print(s[17]=='g')
print(s[2]=='t')
print(s[0]==s[17])
print(s[6]==' ')
print('prog' in s)
print('mm' in s)
print(s.endswith('tion'))
print(s.startswith('py'))

5)

a,b,c=4,3,5

print(a**2+b**2==c**2)

6)

r=5

area=π*r**2

circumference=2*π*r

print(area)

print(circumference)

7)

first="first name"

last="last name"

print(first+last)

print(last+first)

8)

import math
print(-15<-9) ----------->TRUE
print(15==15.0)------->TRUE
print(-8+8==0)--------->TRUE
print(45/9==5)---------->TRUE
print(math.sqrt(25)==5.0)------->TRUE
print(4**2<=15)------->FALSE
print(3**3==9)------>FALSE
print(6-7>=0)-------->FALSE
print(34%4==4)------>FALSE
print(-3**2==-9)------>TRUE

9)

birds = ['crow', 'peacock', 'sparrow', 'dove', 'eagle', 'parrot', 'finch']
1)sublist1=birds[:3]
2)sublist2=birds[:2]
3)sublist3=birds[1:4]
4)sublist4=birds[3:5]
5)sublist5=birds[4:6]

Add a comment
Know the answer?
Add Answer to:
please write these as you would into python. . i will give an thumbs ups 1....
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 the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : Alex got a sequence of n integers a1,a2,…,an as a birthday present. Alex doesn't like negative numbers, so he decided to erase the minus signs from all negative numbers. As a result, he got a sequence of non-negative numbers. Print the resulting sequence. For example, if the sequence is  1, 5, -3, 4,...

  • 3. Write Python statements that will do the following: a) Input a string from the user....

    3. Write Python statements that will do the following: a) Input a string from the user. *** Print meaningful messages along with your output.* b) Print the length of the String. Example input: The sky is blue. Correct output: The length of the string is 16 Incorrect output: 16 c) Print the first character of the string. d) Print the last character of the string. 4. Save the program. Double-check the left edge for syntax errors or warning symbols before...

  • PYTHON The first function you will write should be called ‘countDown’. Your function should take zero...

    PYTHON The first function you will write should be called ‘countDown’. Your function should take zero (0) arguments. The function should return one (1) list containing integers from 10 to 1 and finally, the string “Liftoff!”. (i.e., [10, 9, 8, 7, 6, 5, 4, 3, 2, 1, ‘Liftoff!’]). You function must be recursive (i.e., it should contain a call to itself within the function body). You will get NO credit if you use any loops (for, while, etc). 3. Function...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a...

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

  • urgent help with python. can somone code this please and show output QUESTION: There are a variety of games possi...

    urgent help with python. can somone code this please and show output QUESTION: There are a variety of games possible with a deck of cards. A deck of cards has four different suits, i.e. spades (*), clubs (*), diamonds (), hearts (), and thirteen values for each suit. Now write a function that uses list comprehension to create a deck of cards. Each element in the list will be a card, which is represented by a list containing the suit...

  • Write in C++: Please create a shopping list using the STL list container, then follow the...

    Write in C++: Please create a shopping list using the STL list container, then follow the following instructions. Create an empty list. Append the items, "eggs," "milk," "sugar," "chocolate," and "flour" to the list. Print the list. Remove the first element from the list. Print the list. Insert the item, "coffee" at the beginning of the list. Print the list. Find the item, "sugar" and replace it with "honey." Print the list. Insert the item, "baking powder" before "milk" in...

  • In the python: Note 1: You may not use these python built-in functions: sorted(), min(), max(),...

    In the python: Note 1: You may not use these python built-in functions: sorted(), min(), max(), sum(), pow(), zip(), map(), append(), count() and counter(). For questions 1, 2 and 4: Ask the user to enter the size of a list. Fill the list with random numbers 0-9 and print the list. 1- (8 points) luckyNumbers.py: Find the sum of the numbers in a list, except the number 7 is considered unlucky, so we ignore it and do not include 7's...

  • I need the following merge-sort assignment completed using the "ArrayList<Comparable>" (the part I'm really stuck on)...

    I need the following merge-sort assignment completed using the "ArrayList<Comparable>" (the part I'm really stuck on) with comments: import java.util.ArrayList; public class Mergesort { /** * Sorts list given using the mergesort algorithm * @param list the list to be sorted * @param first the index of the first element of the list to be sorted * @param last the index of the last element of the list to be sorted */ public static void mergesort(ArrayList<Comparable> list, int first, int...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list : You are given a sequence of n positive integers a1,a2,…,an, where n is even. Swap adjacent elements in the given sequence and print the resulting sequence: a2,a1,a4,a3,a6,a5,… Input The first line contains a positive even integer n (2≤n≤1000) — the length of the sequence. The second line contains n space-separated integers a1,a2,…,an (1≤ai≤1000) — the elements of the sequence. Output Print n...

  • write the solution of the program by python 3 language : I need the program using...

    write the solution of the program by python 3 language : I need the program using list or string or loops (while and for) or if,elif,else : You are given a sequence of n non-zero integers a1,a2,…,an. Determine if the given sequence contains a pair of adjacent elements of the same sign (both negative or both positive). Two elements are called adjacent if they stand next to each other in the sequence. Input The first line contains an integer n...

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