Question

In: Computer Science

a summary explaining the basic understanding of the following programming concepts using a language of python:...

a summary explaining the basic understanding of the following programming concepts using a language of python:
•Variables
•Arithmetic and Logical operations
•Sequential coding (Structured programming
•Decision structure (If statements)
•Repetition structure
•Functions
with some coding demos inside visual studio code python IDE which can be sent as screenshot. preferably a typed summary please which can be written into powerpoint pleaseeeee ???

Solutions

Expert Solution

Variables are used as containers for storing data values.

Unlike other programming languages, Python has no specific command for declaring a variable.

In Python A variable is created the moment you first assign a value to it.

Example:----- x = 5
y = "John"
print(x)
print(y)

Variables do not need to be declared with any particular type, and can even change type after they have been set.

x = 4 # x is of type int
x = "Sally" # x is now of type str
print(x)

Arithmetic and Logical operations:----

Arithmetic operators are used with numeric values to perform common mathematical operations

Operator Name Example

+   Addition a+b

-   Subtraction a-b

* Multiplication a*b

/ Division a/b

%   Modulus a%b

Sequential coding (Structured programming):------

Structured programming is a program written with only the three constructions sequence, decision (if..elif statements), and repetition (while or for statements).

Important: the body of a Python if, elif, while, or for statement is indicated by indenting four spaces. Python does not use end statements.

Example:

x = 56
y = 11
z = x + y
print(z)

Decision structure (If statements):-------

if statement is the most simple decision making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e if a certain condition is true then a block of statement is executed otherwise not.

Here, condition after evaluation will be either true or false. if statement accepts boolean values – if the value is true then it will execute the block of statements below it otherwise not. We can use condition with bracket ‘(‘ ‘)’ also.

As we know, python uses indentation to identify a block. So the block under an if statement will be identified as shown in the below example:

i = 20;

if (i < 15):

    print ("i is smaller than 15")

    print ("i'm in if Block")

else:

    print ("i is greater than 15")

    print ("i'm in else Block")

print ("i'm not in if and not in else Block")

Repetition structure:------

  • Repetition statements are called loops, and are used to repeat the same code multiple times in succession.
  • Python has two types of loops: Condition-Controlled and Count-Controlled
  • Condition-Controlled loop uses a true/false condition to control the number of times that it repeats - while. Basic syntax:
  • While condition:
      statement(s) # notice the indent from of this line relative to the while
  •  
    Functions:------
  • A function is a block of code which only runs when it is called.

  • You can pass data, known as parameters, into a function.

  • A function can return data as a result.

  • In Python a function is defined using the def keyword:

  • def my_function():
      print("Hello from a function")

-------I Hope This Will Help You------

--------Plese Give Me Positive Rating------Thank You----------


Related Solutions

Book - Introduction to Programming Using Visual Basic 11th Edition by David I. Schneider Programming Language...
Book - Introduction to Programming Using Visual Basic 11th Edition by David I. Schneider Programming Language - Visual Studio 2017 RESTAURANT MENU Write a program to place an order from the restaurant menu in Table 4.13. Use the form in Fig. 4.70, and write the program so that each group box is invisible and becomes visible only when its corresponding check box is checked. After the button is clicked, the cost of the meal should be calculated. (NOTE: The Checked...
The programming language is Python Instructions: Create a function that will delete a node in a...
The programming language is Python Instructions: Create a function that will delete a node in a Linked List based on position number. On below example, if you want to delete position #2, it will remove the Banana (arrangement of nodes below is Apple, Banana, Cherry, Grapes, Orange). myLinkedList = LinkedList() myLinkedList.append("Banana") myLinkedList.append("Cherry") myLinkedList.append("Grapes") myLinkedList.append("Orange") myLinkedList.prepend("Apple") myLinkedList.deleteByPositionNum(2) node = myLinkedList.head while node: print(node.value, " ") node = node.next_node You may start with the function head: def deleteByPositionNum(self, positionNum):
(20 pts) Using your programming language of choice (from C++, Java, or Python) , also drawing...
(20 pts) Using your programming language of choice (from C++, Java, or Python) , also drawing on your experience from program 1, read an integer, n from keyboard (standard input). This integer represents the number of integers under consideration. After reading that initial integer in, read n integers in, and print the minimum and maximum of all the integers that are read in. Example: Input Output 7 1 5 3 6 9 22 2 Min: 1 Max: 22 C++ preferred
Create a basic program (C programming language) that accomplishes the following requirements: Allows the user to...
Create a basic program (C programming language) that accomplishes the following requirements: Allows the user to input 2 numbers, a starting number x and ending number y Implements a while loop that counts from x (start) to y(end). Inside the loop, print to the screen the current number Print rather the current number is even or odd If the number is even , multiply by the number by 3 and print the results to the screen. If the number is...
Design a Python example that includes the following Basic concepts: Loops Conditional statements two of the...
Design a Python example that includes the following Basic concepts: Loops Conditional statements two of the advanced concepts: Encryption / Decryption, Lists / Dictionaries Please leave a Description of the program
Programming language in Python Suppose, for Jane, n1 = 3, n2 = 4, and n3 =...
Programming language in Python Suppose, for Jane, n1 = 3, n2 = 4, and n3 = 5. Also suppose, Jane iterates the number from 1 to 15. At the beginning, Jane sets count to 0, and then proceeds iterating the number from 1 to 15 and for each iteration does the following: for 1, count is increased by 1 because it is not divisible by 3, 4, and 5; count is now: 1 for 2, count is increased by 2...
Programming language is in python 3 For this project, you will import the json module. Write...
Programming language is in python 3 For this project, you will import the json module. Write a class named NobelData that reads a JSON file containing data on Nobel Prizes and allows the user to search that data. It just needs to read a local JSON file - it doesn't need to access the internet. Specifically, your class should have an init method that reads the file, and it should have a method named search_nobel that takes as parameters a...
Programming language is python 3 For this project, you will import the json module. Write a...
Programming language is python 3 For this project, you will import the json module. Write a class named NeighborhoodPets that has methods for adding a pet, deleting a pet, searching for the owner of a pet, saving data to a JSON file, loading data from a JSON file, and getting a set of all pet species. It will only be loading JSON files that it has previously created, so the internal organization of the data is up to you. The...
Python programming Summary Store the times into arrays called Chevy[ ] and Ford[ ]. Then list...
Python programming Summary Store the times into arrays called Chevy[ ] and Ford[ ]. Then list the winner of each pair, giving the number of seconds the winner won by. At the end declare which team won based on which team had the most wins. Lab Steps There are eight cars in each team called Chevy and Ford. One car from each team races its opponent on the drag strip. Read in the racing times for the eight Chevy cars...
Solve the following question by using python language In range of 1-10000 if the numbers are...
Solve the following question by using python language In range of 1-10000 if the numbers are divisible by n1 increase count by 1 , if the number is divisible by n2 increase count by 2, and if the number are divisible by n3 increase the count by 3 if none of the above conditions match for the number, increase count by the number. n1=10 +17 n2=50 +21 n3=100 +9
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT