Write a function called format_name that accepts a string in the format of first name followed by last name as a parameter, and then returns a string in reverse order (i.e., last name, first name). You may assume that only a first and last name will be given.
For example, format_name("Jared Smith") should return "Smith, Jared"
Hint: The following String Methods will be useful:
# Returns the lowest index in the string where substring is # found. Returns -1 if substring is not found my_string = “eggplant” index = my_string.find(“plant”) # returns 3 # Returns all the characters after the specific index my_string = "hello world!" print my_string[1:] # returns "ello world!" print my_string[6:] # returns "world!" # Returns all the characters before the specific index my_string = "hello world!" print my_string[:6] # returns "hello" print my_string[:1] # returns "h"
Your program should include:
PLEASE HELP PYTHON COMPUTER SCIENCE
In: Computer Science
'''
Problem 1: Formin' Functions
Define and complete the functions described below.
The functions are called in the code at the very bottom. So you
should be
able simply to run the script to test that your functions work as
expected.
'''
'''
* function name: say_hi
* parameters: none
* returns: N/A
* operation:
Uhh, well, just say "hi" when called. And by "say" I mean
"print".
* expected output:
>>> say_hi()
hi
'''
'''
* function name: personal_hi
* parameters: name (string)
* returns: N/A
* operation:
Similar to say_hi, but you should include the name argument in the
greeting.
* expected output:
>>> personal_hi("Samantha")
Hi, Samantha
'''
'''
* function name: introduce
* parameters: name1 (string)
name2 (string)
* returns: N/A
* operation:
Here you are simply including the two names in a basic
introduction.
* expected output:
>>> introduce("Samantha","Jerome")
Samantha: Hi, my name is Samantha!
Jerome: Hey, Samantha. Nice to meet you. My name is Jerome.
'''
# FUNCTIONS ARE CALLED BELOW HERE...NO NEED TO TOUCH ANYTHING
# UNLESS YOU WANT TO COMMENT SOMETHING OUT TO TEST THINGS
# ALONG THE WAY...
say_hi()
personal_hi("Larry")
personal_hi("Naomi")
introduce("Larry","Naomi")
In: Computer Science
Using Perl;
Part 1:
Allow the user to enter a full name in the “first last”
format
Print just the first name
Print just the last name
Print the name in “last, first” format
Print the entire name out in all capital letters
Use a single print statement to print out the first name on one
line and the last name on
the next line.
There should be 5 print statements generating 6 lines of
output.
Part 2:
Enter a three digit number (such as 316)
Print out the number from the hundreds place (for example, 3 in
316)
Print out the number from the ten’s place (for example, 1 in
316)
Print out the number from the one’s place (for example, 6 in
316)
Print out the original number
All output will be appropriately labeled and on a separate line,
such as “hundreds
place”, “tens place”, and so on.
ALL the numeric values MUST be right justified in the output using
formatted output
All work done for this part MUST treat the information as numeric
values – do not treat
the input as a string or as an array.
There should be 4 print statements generating 4 lines of
output.
In: Computer Science
The economic feasibility of a project relies on the identification of its:
I. likely benefits, its expected costs and every cash flow related to the project
II. likely costs and benefits and its expected economic life
III. likely costs and benefits, opportunity costs and irrelevant cash flows
IV. the appropriate inflation and discount rates for the project
V. likely costs, expected depreciation and material sunk cash flows
Select one:
a. III and IV
b. I and III
c. II and IV
d. II and V
e. II and III
In: Finance
Consider a galvanic cell based upon the
following half reactions:
Ag+ + e- → Ag; 0.80 V
Cu2+ + 2 e- → Cu; 0.34 V
Which of the following changes will decrease the potential of the
cell?
Adding Cu2+ ions to the copper half reaction (assuming no volume change). |
|
Adding equal amounts of water to both half reactions. |
|
Adding Ag+ ions to the silver half reaction (assume no volume change) |
|
Removing Cu2+ ions from solution by precipitating them out of the copper half reaction (assume no volume change). |
In: Chemistry
18) A proton travels with a speed (v) of 5m / s in a 2T magnetic
field (B). The angle between v
and B is 22nd. What is the magnitude of the magnetic force acting
on the proton?
(a) 14.8x10-19N (b) 6x10-19N (c) 0N (d) 16x10-19N
19) An electron experiences a magnetic force FB = (i 2.4 - j 1.8)
x10-13N when it passes through a field
magnetic B = k 0.7T. The magnitude of the electron velocity
is:
(a) 1.6x106m / s (b) 2.7x106m / s (c) 2.1x106m / s (d) 4.3x106m /
s
In: Physics
A box has a bottom with one edge 7 times as long as the other. If the box has no top and the volume is fixed at ?V, what dimensions minimize the surface area?
dimensions = ________________
Enter the dimensions as a comma-separated list, e.g., 3,sqrt(12),8. (Your answer may involve V.)
The top and bottom margins of a poster are 2 cm and the side margins are each 6 cm. If the area of printed material on the poster is fixed at 384 square centimeters, find the dimensions of the poster with the smallest area.
Width = ______________(include units)
Height =_____________ (include units)
In: Math
A battery that has a voltage of 20V is attached to a circuit. A current of 4A is created in the circuit. What is the resistance of the circuit? A series circuit with made up of a 12 V battery, a 4Ω resistor, a 8Ω resistor, and a 12Ω resistor. Calculate the equivalent resistance of the circuit. B. Calculate the voltage drop at the 8Ω resistor. A parallel circuit comprised of a 24 V battery and two 48Ω resistor. Calculate the equivalent resistance of the circuit. B. Calculate the total current in the circuit. show the equation you are using, substitute with units, and give your answer with units
In: Physics
a) Typical electric fields in thunderstorms average around 105 V/m. Consider a (roughly) cylindrical thundercloud with height 10 km and diameter 20 km and assume a uniform electric field of 105 V/m. Find the electrical energy contained in the cloud (2 s.f.).
b) For the same thundercloud and imagining that the electric field points vertically downwards, calculate the minimum charge on a 5-mg raindrop that would cause it to accelerate upwards (2 s.f.). (Enter the magnitude of the charge into D2L to check your answer, but the sign is important too in your written solution.)
In: Physics
A voltaic cell consists of a Zn/Zn2+ half-cell and a Ni/Ni2+ half-cell at 25 ∘C. The initial concentrations of Ni2+ and Zn2+ are 1.50 M and 0.110 M , respectively. The volume of half-cells is the same.
Part A
What is the initial cell potential?
Part B
What is the cell potential when the concentration of Ni2+ has fallen to 0.600 M ?
Part C
What is the concentrations of Ni2+ when the cell potential falls to 0.46 V ?
Part D
What is the concentration of Zn2+ when the cell potential falls to 0.46 V ?
In: Chemistry