1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Stells [14]
3 years ago
14

What is the output of the following program? for num in range(4): print (num * 2)

Computers and Technology
1 answer:
kolezko [41]3 years ago
6 0

The range() function with one parameter defaults to a starting value of 0 and has an ending value of the number specified exclusive.

range(4) is all the integers between 0 and 4 not including 4.

for num in range(4):

   print(num*2)

The output would be 0 2 4 6 all on separate lines.

You might be interested in
Write a program that prints the Grade based on the given data. 95-100: A+ 90-94: A 80-89: B+ 70-79: B 60-69: C+ 50-59: C <49
mr Goodwill [35]

Answer:

The program to this question as follows:

Program:

score=int(input("Enter your percentage: ")) #input grade by user

#using conditional statement for match condition  

if 95<=score <= 100: #if value in between 95 to 100

   grade = 'A+' #assign grade

elif 90 <=score <= 94: #elif value in between 90 to 94

   grade = 'A' #assign grade

elif 80 <=score <= 89:  #elif value in between 80 to 89

   grade = 'B+' #assign grade

elif 70 <=score <= 79:  #elif value in between 70 to 79

   grade = 'B' #assign grade

elif 60 <=score <= 69:  #elif value in between 60 to 69

   grade = 'C+' #assign grade

elif 50 <=score <= 59:  #elif value in between 50 to 59

   grade = 'C' #assign grade

elif score<49 :  #elif value is less then 49

   grade = 'F' #assign grade

print (grade) #print grade

Output:

Enter your percentage: 50

C

 Explanation:

In the above python code, a variable "score" is defined, this variable is used for taking value from the user end. In the next step if-elif-else conditional statement is used, this statement is used when a group of statements is given in which one is true. The if block check score value is between 95-100 if this is true it will print A+.

In elif block if the above condition is not true, then this condition will execute, in this block, there are multiple elif block is used that can be described as follows:

  • In the first block, if the value in between 90-94. It will print A.
  • In the second block, if the value in between 80-89. It will print B+.
  • In the third block, if value in between 70-79. It will print B.
  • In the fourth block, if value in between 60-69. It will print C+.
  • In the fifth block, if value in between 50-59. It will print C.
  • In the last, if the value of the score is less then 49. It will print F.
8 0
3 years ago
What is the minimum number of bits you need to encode the 26 letters of the alphabet plus a space?Pace?
Andrei [34K]

Answer

5 bits

Explanation

A bit is the least or the smallest unit of data in a computer. They are  the units of information in information theory, consisting of the amount of information required to specify one of two alternatives 0 and 1. This is because A bit has a single binary value, either 0 or 1

If you use roman alphabet A to Z lets use log 2(26)=4.7 bits. when you round off it will be 5 bits.

8 0
3 years ago
Write the definition of a method dashedLine, with one parameter, an int. If the parameter is negative or zero, the method does n
ZanzabumX [31]

Answer:

import java.util.Scanner;

public class DashLine {

public static void main(String[] args) {

// Declaring variables

int n;

/*

* Creating an Scanner class object which is used to get the inputs

* entered by the user

*/

Scanner sc = new Scanner(System.in);

// Getting the input entered by the user

System.out.print("Enter a number :");

n = sc.nextInt();

// calling the method by passing the user entered input as argument

dashedLine(n);

}

//This method will print the dashed line for number greater than zer

private static void dashedLine(int n) {

if (n > 0) {

for (int i = 1; i <= n; i++) {

System.out.print("-");

}

System.out.println();

}

}

}

Explanation:

5 0
3 years ago
What is hardware?
Dennis_Churaev [7]
The physical devices that make up a computer system
7 0
3 years ago
Read 2 more answers
Name the type of software which provides the user interface. [1 mark
Inessa [10]

Explanation:

user interface, also sometimes called a human-computer interface, comprises both hardware and software components. It handles the interaction between the user and the system.

There are different ways of interacting with computer systems which have evolved over the years. There are five main types of user interface:

command line (cli)

graphical user interface (GUI)

menu driven (mdi)

form based (fbi)

natural language (nli)

7 0
2 years ago
Other questions:
  • Describe some advantages of a 64-bit versus 32-bit version of windows.
    9·1 answer
  • A user has been given Full Control permission to a shared folder. The user has been given Modify permission at the NTFS level to
    11·1 answer
  • Identify a true statement about heuristics: a. They are more complicated than algorithms. b. Unlike algorithms, they do not perm
    15·1 answer
  • Which type of storage disk and disk drive can you use in the given situation?
    12·1 answer
  • *
    6·1 answer
  • What is one disadvantage of transmitting personal data using digital signals?
    15·2 answers
  • I need help 50 points and brainless if you answer
    7·1 answer
  • Create an online order form for a car rental store and include the following items: input text box to enter the number of days i
    14·1 answer
  • Blockchain is often associated with Bitcoin and the financial services industry. However, it is applicable to almost every indus
    13·1 answer
  • What do you think that private information like passwords pin number will be guarded or shared with the public? why?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!