Question

Python)) Data types of Python. Write the python script to show the different examples. Write the...

Python))

  1. Data types of Python. Write the python script to show the different examples.

  1. Write the Python script to present ALL the mathematical arithmetic operations.

  1. Write the Python script to display your - first name, last name, ID, college name and the program of study.

  1. Write the Python script to receive the number of seconds as input and display the hours, minutes and seconds as output.

  1. Assume the variable x to be with the string of "Day by day, dear GOD, of thee three things I pray - to see thee more clearly; to love thee more dearly; to follow thee more nearly, Day by Day - St. Richard of ChiChester”.

Use the Python String Methods: str(), upper(), lower(), count(), find(), replace() & len(). Display the results.

  1. Write the program to determine how much to tip the server in a restaurant. The tip should be 15% of the bill, with a minimum of $2.
  2. A copy center charges 5 cents per copy for the first 100 copies and 3 cents per copy for each additional copy. Write a program that requests the number of copies as input and display the total cost.
  3. Federal law requires that hourly employees be paid “Time and a half” for work in excess of 40 hours in a week. For example, if a person’s hourly wage is $ 12 and he/ she works 60 hours in a week, the person’s gross pay should be:

             (40 * 12) + (1.5 * 12* (60 – 40)) = $840

  1. Display the table of numbers and the square.
  2. Develop the code to find the minimum, maximum and average of a sequence of non- negative numbers entered by the user. The user is told to enter the number -1 to indicate the end of data entry.  
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.

CODE

a = 5

print(a, "is of type", type(a))

a = 2.0

print(a, "is of type", type(a))

a = 1+2j

print(a, "is complex number?", isinstance(1+2j,complex))

a = [5,10,15,20,25,30,35,40]

# a[2] = 15

print("a[2] = ", a[2])

# a[0:3] = [5, 10, 15]

print("a[0:3] = ", a[0:3])

# a[5:] = [30, 35, 40]

print("a[5:] = ", a[5:])

t = (5,'program', 1+3j)

# t[1] = 'program'

print("t[1] = ", t[1])

# t[0:3] = (5, 'program', (1+3j))

print("t[0:3] = ", t[0:3])

s = 'Hello world!'

# s[4] = 'o'

print("s[4] = ", s[4])

# s[6:11] = 'world'

print("s[6:11] = ", s[6:11])

a = {5,2,3,1,4}

# printing set variable

print("a = ", a)

# data type of variable a

print(type(a))

d = {1:'value','key':2}

print(type(d))

print("d[1] = ", d[1]);

print("d['key'] = ", d['key']);

2.

CODE

a = 21

b = 10

c = 0

c = a + b

print("Line 1 - Value of c is ", c)

c = a - b

print("Line 2 - Value of c is ", c)

c = a * b

print("Line 3 - Value of c is ", c)

c = a / b

print("Line 4 - Value of c is ", c)

c = a % b

print("Line 5 - Value of c is ", c)

a = 2

b = 3

c = a**b

print("Line 6 - Value of c is ", c)

a = 10

b = 5

c = a//b

print("Line 7 - Value of c is ", c)

NOTE: As per Chegg policy, I am allowed to answer only 2 coding questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.

Add a comment
Know the answer?
Add Answer to:
Python)) Data types of Python. Write the python script to show the different examples. Write the...
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
  • Python)) A copy center charges 5 cents per copy for the first 100 copies and 3...

    Python)) A copy center charges 5 cents per copy for the first 100 copies and 3 cents per copy for each additional copy. Write a program that requests the number of copies as input and display the total cost. Federal law requires that hourly employees be paid “Time and a half” for work in excess of 40 hours in a week. For example, if a person’s hourly wage is $ 12 and he/ she works 60 hours in a week,...

  • Write a python script that takes a six-digit integer from the user and separate the number...

    Write a python script that takes a six-digit integer from the user and separate the number into its individual digits. You program should then display each digit separated by a comma each. For example, if the user types in the number 654321, the script should display: 6,5,4,3,2,1 You can assume that the user enters the correct number of digits.

  • Program using  Python Q#1 Cost of Bagels: A bagel shop charges 8C cents per bagel for orders...

    Program using  Python Q#1 Cost of Bagels: A bagel shop charges 8C cents per bagel for orders of less than a half-dozen bagels and 60 cents per bagel for orders of a half-dozen or more. Write a program that requests the number of bagels ordered and displays the total cost. How many bagels are ordered: 12 The cost of 12 bagels is $7.20. Q#2 Overtime Pay. Federal law requires that hourly employees be paid "time-and-a-half" for work in excess of 40...

  • PYTHON CODE ONLY PLEASE, AND COMMENT IN SCRIPT TO SHOW STEPS (post copy-ready text code, and also...

    PYTHON CODE ONLY PLEASE, AND COMMENT IN SCRIPT TO SHOW STEPS (post copy-ready text code, and also a screenshot of code running) You work for an on-line game site. Your job is to develop a program that accepts a user name and password. Write a Python script that prompts users for a user name and password. a. The user name should be at least 6 characters long and is stored in a list such that it 1. can't be used...

  • Use Python programming #3 on page 47 of your python programming book: Write a Tipper program...

    Use Python programming #3 on page 47 of your python programming book: Write a Tipper program where the user enters a restaurant bill total. The program should then display two amounts: a 15% tip and a 20% tip. Name your file tipper.py Previous Next.

  • I need help with this python programming exercise, please! thanks in advance Create a Python script...

    I need help with this python programming exercise, please! thanks in advance Create a Python script file called hw4.py. Add your name at the top as a comment, along with the class name and date. Both exercises should be in this file, with a comment before each of them to mark it. Ex. 1. Write a program that inputs an integer number from the user, then prints a letter "O" in ASCII art using a width of 5 and the...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is sued. Write a Python...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is sued. Write a Python code that gets a string containing a person’s first, middle, and last name, and print her/his last name, followed by comma and the first name initial. For example, if the user enters Randy Rick Gomez, the program should display Gomez, R. Please note that in the output, the first character of each name should be capital. Please see the outcomes below: Outcome: Enter your...

  • Write a Python (3) program to simulate** a buffer overflow (this is a new script, not...

    Write a Python (3) program to simulate** a buffer overflow (this is a new script, not part of the intranet assignment), then implement input validation to prevent it. There are two parts to this assignment: 1) The program should display a welcome message and prompt the user for a username. Create a simulated buffer overflow condition by allowing a user to input more data than the size of the allocated memory (causing the program to crash). 2) Implement input validation...

  • Subject: Management information technology (python) Write a program (script mode) that first sets x to a...

    Subject: Management information technology (python) Write a program (script mode) that first sets x to a string with the character 2, y to the value 3, and z to the value 23.3. Using the type function, the program must display the type of each of the following expressions: x y z y+z

  • 1. Write a python script that will compute and display information for a company which rents...

    1. Write a python script that will compute and display information for a company which rents vehicles to its customers. For a specified customer, the program will compute and display the amount of money charged for that customer’s vehicle rental after prompting the user to enter the following four items for a given customer (in the specified order)  The car type (a character either C (compact), M (mid-size), L (luxury), S (SUV), or V (Van) )  The number...

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
ADVERTISEMENT