Python Answers

Questions answered by Experts: 5 288

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Call your function from example 1 three timesWith deferent kind of argument:a value,a variableAnd an expression. identify which kind of argument is which?

5. Groupings


by CodeChum Admin




Instructions:



1. Create a variable that accepts a positive odd integer.



2. Create an empty list. Then, using loops, add random integer values into the list one by one. The number of values to be stored is dependent on the inputted odd integer on the first instruction.



3. Reverse the order of the list. Then, print out the list's new order in this manner:



4. [first-half values]-[middle value]-[second-half values], just like that of the sample output. Make use of list slicing that you’ve learned from the past lessons to easily achieve this segment.




Input



The first line contains an odd positive integer.


The next lines contains an integer.



5


1


3


4


5


2




Output



A line containing a list.



[2,5]-[4]-[3,1]

write a program that takes string as an input and return the product of all individual digit present in string ,return 0


Write the definition of a class Counter containing:

An instance variable named counter of type int

An instance variable named limit of type int.

A constructor that takes two int arguments and assigns the first one to counter and the second one to limit

A method named increment. It does not take parameters or return a value; if the instance variable counter is less than limit, increment just adds one to the instance variable counter.

A method named decrement. It also does not take parameters or return a value; if counter is greater than zero, it just subtracts one from the counter.

A method named get_value that returns the value of the instance variable counter.


Pattern


Input

The first line input contains an Integer(N).


Explanation


Given N = 2 and T = 3

The first line having N spaces

and the last line having no spaces.


sample Input 1

2 2

sample Output 1

**

**


Sample Input 2

2 3

sample Output 2

**

**

**


Write a program that reads a string and returns a table of the letters of the alphabet in


alphabetical order which occur in the string together with the number of times each letter


occurs. Case should be ignored. A sample output of the program when the user enters the data


“ThiS is String with Upper and lower case Letters”, would look this this:



a 2


c 1


d 1


e 5


g 1


h 2


i 4


l 2


n 2


o 1


p 2


r 4


s 5


t 5


u 1


w 2



I want very simple code please

You decide to create a program suits.py to tally and sort the cards in a hand. You include your earlier functions pick_cards(n) and print_cards(h), plus four new ones: tally(h), which creates and returns a dictionary with suit as key and count as value, sort_cards(h) which creates and returns a dictionary with suit as key and a list of the face values as value, print_tally(t), which prints the tally, and print_sorted(s), which prints the cards in each suit


Radioactive decay of radioactive materials can be modeled by the equation


A=Aoe^t(in 2/h) , where A is the amount of the material at time t, A0 is the amount at time 0, and h is the half-life. Technetium-99 is a radioisotope that is used in imaging of the brain. It has a half-life of 6 hours. Your program should display the relative amount A/A0 in a patient body every hour for 24 hours after receiving a dose. Note: With the aid of formatting techniques documented in your note, ensure your program output matches that given below. Program Output


1: 0.890899


2: 0.793701


3: 0.707107


4: 0.629961


5: 0.561231


6: 0.500000


7: 0.445449


8: 0.396850


9: 0.353553


10: 0.314980


11: 0.280616


12: 0.250000


13: 0.222725


14: 0.198425


15: 0.176777


16: 0.157490


17: 0.140308


18: 0.125000


19: 0.111362


20: 0.099213


21: 0.088388


22: 0.078745


23: 0.070154


24: 0.062500


You can approximate pi by using the following summation: pi=4(1−1/3+1/5−1/7+1/9−1/11+⋯+(−1)^i+1/2i-1)

Write a program that displays the pi value for i = 10000, 20000, … and 100000. Program Output

3.1414926535900345

3.1415426535898248

3.141559320256462

3.1415676535897985

3.1415726535897814

3.141575986923102

3.141578367875482

3.1415801535897496

3.1415815424786238

3.1415826535897198


1. Data Structures and Algorithms (Project 1)


INSTRUCTIONS:


Create a program using the following features:

* Array

* Class

* Specific Sorting Algorithm

* Specific Searching Algorithm



LATEST TUTORIALS
APPROVED BY CLIENTS