Use Python and need execution output
Will give upvote!
First Script - Working with Strings
This script contains four parts.
String Type Tests
Escape Characters within a string
Use newline escape characters within a line of haiku
Type, type, type away.
Compile. Run. Hip hip hooray!
No error today!
Haiku by Samantha W.Slicing a string
Using string operators + and *
.~*''*~..~*''*~..~*''*~..~*''*~..~*''*~.
Second Script:
Printing a well formatted invoice
Use three named "constants" for the following:
small beads with a price of 9.20 dollars per box
medium beads with a price of 8.52 dollars per box
large beads with a price of 7.98 dollars per box
Ask the user how many boxes of small beads, how many boxes of medium beads, and how many large beads they need (use the int Built-in Function to convert these values to int).
Print the invoice in the following format:
SIZE QTY COST PER BOX TOTALS Small n x.xx xx.xx Medium n x.xx xx.xx Large n x.xx xx.xx TOTAL xxx.xx
Replace the n and x placeholders with actual numeric data values. Right align all numeric values. All dollar amounts should have two decimal places and should align on the decimal point.
Test your script twice, first with user input of 10 boxes of small beads, 9 boxes of medium beads, and 8 boxes of large beads, and then a second time with user input of 5 boxes of small beads, 10 boxes of medium beads, and 15 boxes of large beads.
Add the following at the end of each script to show your results
thanks for the question, here are all the solutions to the problem asked in the question.
===========================================================================================
user_string=input("Enter a string: ")
print('is upper?
{}'.format(user_string.isupper()))
print('is digit?
{}'.format(user_string.isdigit()))
print('is alpha?
{}'.format(user_string.isalpha()))
#Use newline escape characters within a line of haiku
haiku='Type, type, type
away\nCompile. Run. Hip hip
hooray!\nNo error
today!'
print(haiku)
quote='And now for something completely
different'
print(quote[0:6])
print(quote[-4:])
print(quote[14:16])
#obtain the text "Adnwf..."
print(quote[0:1]+quote[-9:-8]+quote[1:2]+quote[1:2]+quote[6:7]+quote[8:9])
#ext "tnere..." by reversing
print(quote[-1]+quote[-2]+quote[-3]+quote[-4]+quote[-5])
pattern1='.~*\''
pattern2=pattern1+pattern1[-1]+pattern1[-2]+pattern1[-3]+pattern1[-4]
#Print pattern2 repeated five times. The output should appear as
follows:
for _ in range(5):
print(pattern2,end='')
print()
#####################################################################
small_beads=9.20
medium_beads=8.52
large_beads=7.98
small=medium=large=0
small=eval(input('How many small beads: '))
medium=eval(input('How many medium beads:
'))
large=eval(input('How many large beads: '))
print('{0:<10}{1:<5}{2:>15}{3:>8}'.format('SIZE','QTY','COST
PER BOX','TOTALS'))
print('{0:<10}{1:<5}{2:>15.2f}{3:>8.2f}'.format('Small',small,small_beads,small*small_beads))
print('{0:<10}{1:<5}{2:>15.2f}{3:>8.2f}'.format('Small',medium,medium_beads,medium*medium_beads))
print('{0:<10}{1:<5}{2:>15.2f}{3:>8.2f}'.format('Small',large,large_beads,large*large_beads))
print('{0:<30}{1:>8.2f}'.format('TOTAL',large*large_beads+small*small_beads+medium*medium_beads))
==========================================================================================

thank you so much !
Use Python and need execution output Will give upvote! First Script - Working with Strings This...
Use Python WingPersonal to compile and also please give output Math and String operations Write a script to perform various basic math and string operations. Use some functions from Python's math module. Generate formatted output. Basic math and string operations Calculate and print the final value of each variable. a equals 3 to the power of 2.5 b equals 2 b equals b + 3 (use +=) c equals 12 c = c divided by 4 (use /=) d equals...
Use Python Write a script to perform various basic math and string operations. Use some functions from Python's math module. Generate formatted output. Basic math and string operations Calculate and print the final value of each variable. a equals 3 to the power of 2.5 b equals 2 b equals b + 3 (use +=) c equals 12 c = c divided by 4 (use /=) d equals the remainder of 5 divided by 3 Built-in functions abs, round, and...
Create a user friendly interface to order a pizza. Use appropriate controls (radio buttons, list boxes, check boxes) to obtain the type of pizza (e.g. small, medium, large) and the toppings. Calculate the cost of the pizza based upon the size, number of toppings and delivery charge. Display a summary of the order in a text area along with the total cost. Provide buttons which places the order and clears the order. Allow for multiple pizzas to orders Submit as...
Need help to resize your images so that they all take up less than 50 K of disc space. To resize an image using MS Notepad: Right click on the image in the Windows Explorer and open it with Notepad. Select Main Menu Resize >> In the Resize box Leave Percentage radio button selected >> Enter 50 and 50 in the Horizontal and Vertical text boxes to reduce the width and height of the image by 50%. Click OK. Right...
I need to code that statement in python. The Bold is code we
were given and the italics are the statements we need to code.
oa- ← > C q p t crant ps bb er nauedubbc vebda pid 26210 4-dtcc entid 57221440 1 co ses 1177 NAU00-ISM 320-SECOC2-3961 NAL PSSS Li u Lat6F17see2%281%29 df ::: Apcs welcome Spencer- NFLPl2ers b Cole 訂: YouTube Red-3:es gr Rac-12com Feeds ma Oreon2018 Basce ma Oreocn20'8 Footb2 1 Gobal Gamo wth Cther toocmais...
Hi Guys,
Need help on python questions
Question 3. At the Singapore Zoo, each adult ticket costs $ 39, each child (>= 3 years old, <= 12 years old) ticket costs $26.50 and each young child (< 3 years old) ticket is free. Write a program to ask the user to enter the number of tickets for each type and then display the ticket information. Your code must work exactly like the following example (the text in bold indicates the...
I have the code buts its not working as this below instruction can anyone help Use the requirements from the pizza part of Assignment 6 and do the following using CSS and an internal style sheet: 1. Your Javascript function should be in an external file (don’t forget to move it up to studentweb too) 2. Put a red border of 300px in width around the form 3. There should be three Div sections: header, main_body, and footer. 4. Center the name of your...
(Write or type in answers, except for problem #15, which should be entered as a small program, tested, and submitted in Repl.it) 1. Write a Python statement to define a list named temps using the following elements, in order: 95, 100, 77, 54, 103, 82 2. a) What is the length of the list temps? b) What Python function can be used to obtain the length of the list? Use it in a statement to obtain the length of temps...
could you please help me with this problem, also I
need a little text so I can understand how you solved the
problem?
import java.io.File; import java.util.Scanner; /** *
This program lists the files in a directory specified by * the
user. The user is asked to type in a directory name. * If the name
entered by the user is not a directory, a * message is printed and
the program ends. */ public class DirectoryList { public static...
Recursion and Trees Application – Building a Word Index Make sure you have read and understood · lesson modules week 10 and 11 · chapters 9 and 10 of our text · module - Lab Homework Requirements before submitting this assignment. Hand in only one program, please. Background: In many applications, the composition of a collection of data items changes over time. Not only are new data items added and existing ones removed, but data items may be duplicated. A list data structure...