Question

In: Computer Science

make a python script that has the following typed: school = “cochise college” place = “online”...

make a python script that has the following typed:

school = “cochise college”

place = “online”

Then do the following with the given parameters.Set the script to have a function that takes two parameters, school and place, have your function return the first 5 characters of each parameter value, utilizing a slice. Change the script to have a function that takes two parameters, school and place, have your function return the first character of each parameter, utilizing an index value. Then, Modify the script to have a function that takes two parameters, school and place, have your function return the last character of the variable place for each parameter, utilizing an index value. Next, modify the script to have a function that takes two parameters, school and place, have your function return the variables school and place in title form. Lastly, modify the python script to have a function that takes two parameters, school and place, have your function check to verify that ‘cochise’ is in the school parameter and ‘online’ is in the place parameter. If it is have the function return, ‘Great you go to Cochise College Online!’, else have the function return, ‘You should check out Cochise College Online!’

Solutions

Expert Solution

#Python code

def firstFiveCharacter(school, place):
    return school[0:5], place[0:5]

def firstCharacter(school, place):
    return school[0], place[0]

def lastCharacter(school, place):
    return school[len(school)-1], place[len(place)-1]
def titleCase(school, place):
    return school.title(), place.title()

def isContains(school, place):
    if 'cochise' in school and 'online' in place :
        return "Great you go to Cochise College Online!"
    else:
        return "You should check out Cochise College Online!"


if __name__ == "__main__":
    school = "cochise college"
    place = "online"
    s, p =firstFiveCharacter(school, place)
    print("First Five Characters: ")
    print(s)
    print(p)
    fs, fp = firstCharacter(school, place)
    print("First Characters: ")
    print(fs)
    print(fp)
    ls, lp = lastCharacter(school, place)
    print("Last characters: ")
    print(ls)
    print(lp)
    print("title Case: ")
    ts, tp = titleCase(school, place)
    print(ts)
    print(tp)
    print("if School contains 'cochise' and place contains 'online'")
    msg = isContains(school, place)
    print(msg)

#Screenshots for indentation help

#output

//if you need any help regarding this solution .......... please leave a comment ...... thanks


Related Solutions

The school bookstore wants you to write a Python script to calculate the point of sale...
The school bookstore wants you to write a Python script to calculate the point of sale (total cost) of their new 25$ gift cards. They are also running a special, if a customer buys a gift card they can buy all books for 5$ dollars each. The gift card cost is $25.00 plus $5.00 per book. In addition, there is a sales tax which should be applied to the subtotal and it is 8% (multiply the subtotal by 0.08.) Requirements:...
The school bookstore wants you to write a Python script to calculate the point of sale...
The school bookstore wants you to write a Python script to calculate the point of sale (total cost) of their new 25$ gift cards. They are also running a special, if a customer buys a gift card they can buy all books for 5$ dollars each. The gift card cost is $25.00 plus $5.00 per book. In addition, there is a sales tax which should be applied to the subtotal and it is 8% (multiply the subtotal by 0.08.) Requirements:...
The school bookstore wants you to write a Python script to calculate the point of sale...
The school bookstore wants you to write a Python script to calculate the point of sale (total cost) of their new 25$ gift cards. They are also running a special, if a customer buys a gift card they can buy all books for 5$ dollars each. The gift card cost is $25.00 plus $5.00 per book. In addition, there is a sales tax which should be applied to the subtotal and it is 8% (multiply the subtotal by 0.08.) Requirements:...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program:...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program: Your program will create a username of your choice using a Kali Linux command "useradd -m mark", then set the password for that user using the Kali Linux Command "echo "mark:10101111" | chpasswd". Then you create a dictionary file using the Kali Linux command "crunch 8 8 01 > mylist.txt" Your python script should crack the password for that user and display on the...
Write the following Python script: Imagine you live in a world without modules in Python! No...
Write the following Python script: Imagine you live in a world without modules in Python! No numpy! No scipy! Write a Python script that defines a function called mat_mult() that takes two lists of lists as parameters and, when possible, returns a list of lists representing the matrix product of the two inputs. Your function should make sure the lists are of the appropriate size first - if not, your program should print “Invalid sizes” and return None. Note: it...
Write the following Python script: Imagine you live in a world without modules in Python! No...
Write the following Python script: Imagine you live in a world without modules in Python! No numpy! No scipy! Write a Python script that defines a function called mat_mult() that takes two lists of lists as parameters and, when possible, returns a list of lists representing the matrix product of the two inputs. Your function should make sure the lists are of the appropriate size first - if not, your program should print “Invalid sizes” and return None. Note: it...
Write the following Python script: Imagine you live in a world without modules in Python! No...
Write the following Python script: Imagine you live in a world without modules in Python! No numpy! No scipy! Write a Python script that defines a function called mat_mult() that takes two lists of lists as parameters and, when possible, returns a list of lists representing the matrix product of the two inputs. Your function should make sure the lists are of the appropriate size first - if not, your program should print “Invalid sizes” and return None. Note: it...
Python 3 Script: A company has classified its employees as follows.
Python 3 Script: A company has classified its employees as follows.Managers Hourly workersCommission workers Pieceworkers- who receive a fixed weekly salary- who receive a fixed hourly wage for up to the first 40 hours they work and“time-and-a-half”, i.e. 1.5 times their hourly wage, for overtime hours worked), - who receive $250 plus 5.7% of their gross weekly sales)- who receive a fixed amount of money per item for each of the items theyProduce. Each pieceworker in this company works on...
Please make a little adjust for the following script then make it work for Runge Kutta...
Please make a little adjust for the following script then make it work for Runge Kutta method Consider the initial value problem du/dt=t^5   u(0)=0 0<=t<=1 Q1. how we change the below script to make it to solve the above IVP and the answer should be near 4 here is the script f =@(t ,y)(t^5); % define f by f(t,y)=y^5 for k =1:10 [ tlist , ylist ]= RKfour174 (f ,0 ,1 ,0, 2^k); error1 (k)= max ( abs ( ylist...
Submit a processed dataset and Python or SAS script that has been used along with a...
Submit a processed dataset and Python or SAS script that has been used along with a short description of the steps you have been following.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT