Computer Science, asked by sukritisoni2008, 6 months ago

Please answer these computer questions fast please chapter 6 introducing python cyber beans class 7th ​

Attachments:

Answers

Answered by gunnuagarwal
19

Answer:

hope its helpul to you!!!

please mark me as brainlest

thank you

Attachments:
Answered by preranaaa
2

1.

Python programming has lots of features. Four important features are as follows-

  1. Easy to code: Python code looks like simple English words. There is no use of semicolons or brackets.
  2. Interpreted: The word interpreted means that the code is run line by line and not the whole program at once.
  3. Robust standard Library: Python has many standard libraries available. This makes it very easy for the programmers as they don’t have to write their code for every single thing. This helps in saving time
  4. Portable: Portable means the same python code can be run on different systems. Suppose you write a code on windows you can still run it on a mac without making any changes.

2.

A Python variable is a reserved memory location to store values. In other words, a variable in a python program gives data to the computer for processing.

For example, if "a" is a variable and the program is to print a

a = 100

print(a)

Rules for naming a variable are as follows-

  • Variable name should start with letter(a-zA-Z) or underscore (_): Example - _vp, vp, Vp
  • In variable name, no special characters are allowed other than underscore (_): Example - *vp (not allowed)
  • Variables are case sensitive: This means vp is different from Vp
  • Variable name can have numbers but not at the beginning: Example - 1vp(not allowed), vp1(allowed)
  • Variable name should not be a Python keyword: Keywords like pass, continue, and break can't be used as a variable.

3.

Python has two working modes: Interactive mode and script mode

Interactive mode:

  • Interactive means “working simultaneously and creating impact of our work on the other’s work”. Interactive mode is based on this ideology only.
  • In interactive mode as soon as we click enter for a command given we get the output.
  • the output in this mode is dependent only on the last command given
  • The interactive mode is very suitable for beginners in programming as it helps them evaluate their code line by line and understand the execution of code well.
  • Example: print("hello world) => output Hello world

Script mode:

  • Script means a system of writing.
  • In the script mode, a python program will be written in a file. This file can then be saved and executed using the command prompt.
  • Steps to be followed to make a script mode program:
  • 1. Type your code in any text editor like notepad
  • 2. Save it as a ".py" file
  • 3. Open the command prompt and type "filename.py" and press enter
  • 4. The output will be shown on the command prompt

4.

Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data.

Numeric data type:

  • Numeric data type represents the data that has a numeric value.
  • There are three types of numeric data types. They are:
  • 1. Integer: Given by int. It stores a value of any positive or negative whole number (no fractions or decimals). Ex: a = 5
  • 2. Float: Given by float. It stores values of real numbers with floating-point values, i.e., decimal or fraction. Ex: a = 4.9
  • 3. Complex number: This is in the form of real part + (imaginary part)j. Ex: a = 8+3j

Sequence data type:

  • Sequence is the ordered collection of similar or different data types.
  • Sequences allow storing of multiple values in an organized and efficient fashion
  • There are three types of sequence data types. They are:
  • 1. List: Given by lst. An ordered collection of data. It is very flexible as the items in a list do not need to be of the same type.
  • 2. String: Given by str. A string is a collection of one or more characters put in a single quote, double-quote
  • 3. Tuple: Given by tup. Just like a list, a tuple is also an ordered collection of Python objects. The only difference between tuple and list, tuples cannot be modified after it is created

5.

The print() function prints the specified message to the screen or another standard output device.

The 'sep' parameter is used for separate function.

print("hello","world",sep="-")

output => hello-world

The "\n" parameter is used for the new line character.

print("hello","\n","world")

output => hello

world

6.

An interpreter translates just one statement of the program at a time into machine code,  whereas a compiler scans the entire program and translates the whole of it into machine code at once. An interpreter takes very less time to analyze a code, but executing the whole process is much slower than a compiler. An interpreter unlike a compiler doesn't generate an intermediary code. Hence, an interpreter is highly efficient in terms of its memory. Interpreters are used by programming languages like Python, Ruby, etc.

Similar questions