Explanation of Solution
a.
print ("Hello, world! ")
Explanation:
The above statement is used ...
Explanation of Solution
b.
print ("Hello", "world! ")
Explanation:
The above statement is used to pr...
Explanation of Solution
c.
print (3)
Explanation:
The above statement is used to print integ...
Explanation of Solution
d.
print (3.0)
Explanation:
The above statement is used to print double value “3...
Explanation of Solution
e.
print (2+3)
Explanation:
The above statement is used to...
Explanation of Solution
f.
print (2.0+3.0)
Explanation:
The above statement is used to p...
Explanation of Solution
g.
print ("2"+"3")
Explanation:
The above statement is used to print the string ...
Explanation of Solution
h.
print ("2+3=", 2+3)
Explanation:
The above statement is used to print the string “2+3”...
Explanation of Solution
i.
print (2*3)
Explanation:
The above statement is used to print the val...
Explanation of Solution
j.
print (2**3)
Explanation:
The above statement is used to print the val...
Explanation of Solution
k.
print (7/3)
Explanation:
The above statement is used to print the value of &#x...
Explanation of Solution
l.
print (7//3)
Explanation:
The above statement is used to print the val...
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Python Programming: An Introduction to Computer Science, 3rd Ed.
- code for python: Write a program that asks the user to guess a random number between 1 and 5. If they guess right, they get 10 points added to their score, and they lose 1 point for an incorrect guess. Give the user five numbers to guess and print their score after all the guessing is done. Also, keep track of the number of right & wrong guesses.arrow_forwardExercise 2: Write a Python program that reads from the user an integer n, displays the triangular number sequence up to the nh term (i.e. 1, 3, 6, 10, ..., calculated as "n(n+1)/2" where n is a nonzero positive number. Note that your program should display a suitable error message if n is entered as a zero or a negative number. nth term). The triangular of a number n is Triangular ======== 1 3 3 6 4 10 5 15 Figure 2- Sample Run for n=6arrow_forwardUsing introduction to Python You have been asked to write an application that automatically grades a quiz. The quiz has 15 multiple-choice questions. The correct answers are: 1.A, 2.C, 3.A, 4.B, 5.B, 6.D, 7.D, 8.A, 9.C, 10.A, 11.B, 12.C, 13.D, 14.C, 15.B The program will start by creating a list holding the quiz answers key shown above. It will then prompt the user for the student name and their answers file and read them into a separate list. It will finally compare the key vs. answers lists to calculate & display: Number of correct answersNumber of incorrect answersQuestions incorrectly answered.Whether the student has passed or failed the quizA student must correctly answer 11 out of 15 questions to pass.The user can grade as many students as they wish. Notes The file containing the student’s answers is organized as 15 lines. Each line contains the answer to the corresponding question. The responses are single character strings, from A to D, uppercase. Must use functional…arrow_forward
- Using Python: Description Write a program that asks the user to enter an amount of money in the format of dollars and remaining cents. The program should calculate and print the minimum number of coins (quarters, dimes, nickels and pennies) that are equivalent to the given amount.Hint: In order to find the minimum number of coins, first find the maximum number of quarters that fit in the given amount of money, then find the maximum number of dimes that fit in the remaining amount, and so on. For example, an execution should look like this:Please enter the amount of money to convert:# of dollars: 2# of cents: 37The coins are 9 quarters, 1 dimes, 0 nickels and 2 penniesarrow_forwardTask 15 Write a Python program that takes a number and tells if it is a perfect number or not. [The input number has to be an INTEGER] Perfect Number: An integer number is said to be a perfect number if its factors, including 1 but not the number itself, sum to the number. Example01: Input: 6 Output: 6 is a perfect number Explanation: 6 have 4 divisors: 1, 2, 3, and 6. If we add all factors except itself, 6 = 1 + 2 + 3.arrow_forwardTask 8 Write Python code of a program that reads an integer, and prints the integer if it is a multiple of 2 and 5. For example, 10, 20, 30, 40, 50 .. hint(1): use the modulus (%) operator for checking the divisibility hint(2): You can consider the number to be an integer Example01: Input: 5 Output: Not multiple of 2 and 5 botharrow_forward
- 1. Take the sentence: "Hello there how are you?" Store each word in a separate variable, then print out the sentence on one line using print(). 2. Write a Python to ask the user for the time now (in hours), and ask for the number of hours to wait. Your program should output what the time will be on the clock when the alarm goes off. 3. Print (name, height) in two organized columns.arrow_forwardCreate using python. Program Specifications: Computer should generate 4 random numbers from 1 - 9 as the "Secret Code". User should be prompted for their guess of those four numbers. After they provide their full guess, the user is told how many are correct. As long as the user does not get all four correct, they keep getting asked for their guess. After the user finally gets all of them correct (yes - all four), they are congratulated and then told how many tries it took them. Technical Requirements: Use at least one list Use at least one function with parametersarrow_forwardTask 9 Write Python code of a program that reads an integer, and prints the integer if it is a multiple of NEITHER 2 NOR 5. For example, 1, 3, 7, 9, 11, 13, 17, 19, 21, 23, 27, 29, 31, 33, 37, 39 ... hint(1): use the modulus (%) operator for checking the divisibility hint(2): You can consider the number to be an integer !%3%===== Example01: Input: 3 Output: 3arrow_forward
- Write a program that prompts the user for a text up to 20 characters long and makes a copy of it. Make sure that the copy uses only the amount of memory that is absolutely necessary. ( in C language)arrow_forwardUSE PYTHON A small shop sells 280 different items. Each item is identified by a 3 – digit code. All items that start with a zero (0) are cards, All items that start with a one (1) are sweets, All items that start with a two (2) are stationery and All items that start with a three (3) are toys. Write a program which inputs the 3 – digit code for all 280 items and outputs the number of cards, sweets, stationery and toys.arrow_forwardWrite a program in python Suppose a right triangle is placed in a plane as shown below. The right-angle point is at (0, 0), and the other two points are at (200, 0), and (0, 100). Write a program that prompts the user to enter a point with x- and y-coordinates and determines whether the point is inside the triangle. Sample runs of the program are given below: Enter a point's x- and y-coordinates: 100.5 25.5 The point is in the triangle Enter a point's x- and y-coordinates: 100.5 50.5 The point is not in the trianglearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education