Working with data types, boolean expressions & making decisions. Create one .py source file for each...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Working with data types, boolean expressions & making decisions. Create one .py source file for each task. Tasks Task 1 (3 marks) 1) Create 4 variables with four distinct data types and values (2 marks) 2) Output each variable using one output statement (1 mark) Task 2 (6 marks) 1) Ask the user for 3 text values (1 mark) 2) Determine which text is the longest (4 marks) a) Output both the length and the value of the longest text (1 mark) i) Hint: There are 7 possibilities Task 3 (6 marks) 1) Ask the user for input. (1 mark) 2) Determine if the user input is a number a) If so, (1 mark) i) Typecast the input to a numerical data type. (1 mark) ii) Output the number (1 mark) b) If not, (1 mark) i) Output the number of characters of the user input (1 mark) Task 4 (7 marks) 1) Ask user for input (1 mark) 2) Using one IF statement block (1 mark) a) Determine if input is i) a string greater than 3 characters (1 mark) (1) Display a message stating that the string is greater than 3 characters (1 mark) ii) an empty string (1 mark) (1) Display a message stating that the string is empty (1 mark) b) If neither of the above cases are true, display message thanking user for input. (1 mark) Working with data types, boolean expressions & making decisions. Create one .py source file for each task. Tasks Task 1 (3 marks) 1) Create 4 variables with four distinct data types and values (2 marks) 2) Output each variable using one output statement (1 mark) Task 2 (6 marks) 1) Ask the user for 3 text values (1 mark) 2) Determine which text is the longest (4 marks) a) Output both the length and the value of the longest text (1 mark) i) Hint: There are 7 possibilities Task 3 (6 marks) 1) Ask the user for input. (1 mark) 2) Determine if the user input is a number a) If so, (1 mark) i) Typecast the input to a numerical data type. (1 mark) ii) Output the number (1 mark) b) If not, (1 mark) i) Output the number of characters of the user input (1 mark) Task 4 (7 marks) 1) Ask user for input (1 mark) 2) Using one IF statement block (1 mark) a) Determine if input is i) a string greater than 3 characters (1 mark) (1) Display a message stating that the string is greater than 3 characters (1 mark) ii) an empty string (1 mark) (1) Display a message stating that the string is empty (1 mark) b) If neither of the above cases are true, display message thanking user for input. (1 mark)
Expert Answer:
Answer rating: 100% (QA)
Task 1 1 Create 4 variables with four distinct data types and values stringvalue Hello World integer... View the full answer
Related Book For
Smith and Roberson Business Law
ISBN: 978-0538473637
15th Edition
Authors: Richard A. Mann, Barry S. Roberts
Posted Date:
Students also viewed these programming questions
-
In this numerical project, we observe Corollaries 3.16 and 3.17 in action. Consider n = 1,..., 20. For each n, consider the dyadic partition of [0,1] given by t;= j/2". Sample a single Brownian path...
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Four different processes for baking Oreo cookies are considered for the 2008 season. The cookies produced by each process are evaluated in terms of their overall quality. Since the cookies sometimes...
-
New machinery, which replaced a number of employees, was installed and put in operation in the last month of the fiscal year. The employees had been dismissed after payment of an extra months wages,...
-
An archer hits a bull's-eye with a probability of 0.09. and the results of different attempts can be taken to be independent of each other, [f the archer shoots nine arrows, calculate the probability...
-
(a) Show that Eqs. 8.47 reduce to Eqs. 8.46 when you consider a system of just one object. (b) Follow the procedure used to get from Eq. 8.21 to Eq. 8.24 for a system of many interacting objects....
-
Cardinals Corporation purchased a computer on December 31, 2013, for $105,000, paying $30,000 down and agreeing to pay the balance in five equal installments of $15,000 payable each December 31...
-
Who were some of the principal Portuguese explorers? What did they achieve and what were the ramifications of these voyages for Portugal, and the world?
-
The following information is available for the preparation of the governmentwide financial statements for the city of Southern Springs as of April 30, 2020: From the preceding information, prepare,...
-
The 70-kg boy slides down the smooth water slide. If he starts from rest at A, determine his speed when he reaches B and the normal reaction the slide exerts on the boy at this point. Y= 0.075x2 7.5m...
-
The manager of a major league baseball team argues: Even if I thought Player X was washed up, I couldnt get rid of him. Hes in the third year of a four-year, $24-million deal. Our team is in no...
-
Workers in a certain job are trained by the company, and the company calculates that to recoup its investment costs, the workers wages must be $5 per hour below their marginal productivity. Suppose...
-
Assume that a state government currently provides no child-care subsidies to working single parents, but it now wants to adopt a plan that will encourage labor force participation among single...
-
Suppose Congress were to mandate that all employers had to offer their employees a life insurance policy worth at least $50,000 in the event of death. Use economic theory, both positively and...
-
The way the workers compensation system works now, employees permanently injured on the job receive a payment of $X each year, whether they work or not. Suppose the government were to implement a new...
-
Which of the following words means fear of many things? A. multiphobic OB. quadriphobia OC. macrophobia D. superphobic O E. polyphobia
-
Copy and complete the statement. 3800 m ? km =
-
Division West Chinchilla Ranch advertised on television that a five-figure income could be earned by raising chinchillas with an investment of only $3.75 per animal per year and only thirty minutes...
-
Consolidated Business Forms leased a Phillips business computer from Benchmark. Benchmark subsequently transferred the lease and promissory note to Exchange International Leasing Corporation....
-
Miss Horowitz was admitted as an advanced medical student at the University of MissouriKansas City. During the spring of her first year, several faculty members expressed dissatisfaction with Miss...
-
The Nielsen ratings are well known for their role in gauging television viewing. Identify another way that statistics are used in the entertainment industry. Briefly describe the role of statistics...
-
The government regularly publishes many different economic statistics, such as the unemployment rate, the inflation rate, and the surplus or deficit in the federal budget. Study recent newspapers and...
-
Consider the quadratic programming problem. min x+x s.t. 1x2 = 4. x1
Study smarter with the SolutionInn App