The key takeaways are: 1). Errors in python: -Errors are the problems in a program due to which the program will stop the execution. On the other hand, exceptions are raised when some internal events occur which changes the normal flow of the program. 2). Syntax error: -When the proper syntax of the language is not followed then a syntax error is thrown. 3). Index error: – Lists are one of the most used data structures in Python. Index is the one used in a List. You might have gotten the message “Index Error: list index out of range” when your program ran into an error while using lists. 4). Module error: – As the name implies, this error occurs when you’re trying to access or use a module that cannot be found. In the case of the title, the “module named Python” cannot be found. 5). Key error: – generally means the key does not exist in a dictionary result in key error. 6). Import error: – There are two conditions when the Import Error will be raised. one is If the module does not exist and the second one is If we are trying to import submodule from the module. 7). Stop iteration error is thrown when the next function is going beyond the number of items in the iteration. 8). Type error: – Type Error is an exception in Python programming language that occurs when the data type of objects in an operation is inappropriate. For example, if you attempt to divide an integer with a string, the data types of the integer and the string object will not be compatible. Due to this, the Python interpreter will raise a Type Error exception as shown in the following example. 9). Value error: – A Value error in Python is a fairly simple concept. When you assign the wrong value to an object, you will get a Value error. 10). Name error: – It occurs when the variable is not defined. 11). Zero division error: – It occurs when the variable is divided by zero. 12). keyboard interrupt error: – Keyboard Interrupt exception is a part of Python’s built-in exceptions. When the programmer presses the ctrl + c or ctrl + z command on their keyboards, when present in a command line (in windows) or in a terminal (in mac os/Linux), this abruptly ends the program amidst execution
Category: Python Course on Multiple languages-Python programming
Numbers and Math Functions – Activity
Hello world- Activity
2. Write the correct input : ______(“Hello World”)
3. What is the correct syntax from the following
Python IDE – Activity
- What can we write to check what version of Python is running on our system in the Windows Command Prompt?
Ans. py.
2. What is the other option besides writing “py” to check the version in the Windows CMD?
Ans. Python –version.
3. What is the full form of IDE?
Ans. Integrated Development Environment.
4. An IDE consists of all the necessary Development tools that a programmer needs in one place.
Ans. True.
why python?- Activity
2. When was Python created?
3.Python can work on different platforms as well?
Python course overview- Activity
- This course is for anyone who is even in their starting stages of programming.
Ans. True.
- What is the first topic we will be covering?
Ans. why python.
- What is the expected excitement level from you?
Ans. 100,000!!!!
Get a list of names as an input from the user and make the first letters in caps and print each word as a list
#Get a list of name as an input from the user and make the first letters in caps and print each word as a list
n = int(input("Enter total number of names n = "))
names = []
print("\n Enter names: \n")
for i in range(0, n):
x = input()
names.append(x)
print("\n Names with first letters in caps are:\n")
for i in range(0, n):
print(names[i].capitalize())

functions as arguments (Notes)
functions as arguments: –
1). Information can be passed into functions as arguments. Arguments are specified after the function name, inside the parentheses. You can add as many arguments as you want, just separate them with a comma. The following example has a function with one argument (fname). When the function is called, we pass along a first name, which is used inside the function to print the full name.
2).Arguments are often shortened to args in Python documentations.
3). Parameters vs Arguments: – The terms parameter and argument can be used for the same thing: information that are passed into a function. From a function’s perspective: A parameter is the variable listed inside the parentheses in the function definition. An argument is the value that are sent to the function when it is called.
4).Number of Arguments: – By default, a function must be called with the correct number of arguments. Meaning that if your function expects 2 arguments, you have to call the function with 2 arguments, not more, and not less. If you try to call the function with 1 or 3 arguments, you will get an error.
5). one can pass functions as parameters in a function
Classes and Objects in Python (Notes)
Classes and Objects: –
1). Python is an object oriented programming language.Almost everything in Python is an object, with its properties and methods.
A Class is like an object constructor, or a “blueprint” for creating objects.In order to Create a Class use the keyword class.
2). Creating an Object: – example:- Now we can use the class named MyClass to create objects.Create an object named p1, and print the value of x.
3). The __init__() Function: – The examples above are classes and objects in their simplest form, and are not really useful in real life applications.To understand the meaning of classes we have to understand the built-in __init__() function. All classes have a function called __init__(), which is always executed when the class is being initiated. Use the __init__() function to assign values to object properties, or other operations that are necessary to do when the object is being created.
4). The __str__() Function: – The __str__() function controls what should be returned when the class object is represented as a string.
If the __str__() function is not set, the string representation of the object is returned.
5). Object Methods: – Objects can also contain methods. Methods in objects are functions that belong to the object.
6). The self Parameter: – The self parameter is a reference to the current instance of the class, and is used to access variables that belongs to the class. It does not have to be named self , you can call it whatever you like, but it has to be the first parameter of any function in the class.
7). Modify Object Properties: – You can modify properties on objects.
8). Delete Object Properties: – You can delete properties on objects by using the del keyword.
9). Delete Objects: – You can delete objects by using the del keyword,
10). The pass Statement: -class definitions cannot be empty, but if you for some reason have a class definition with no content, put in the pass statement to avoid getting an error.
Hello world Program (Notes)
The Key takeaways are:
1). writing hello world program using PyCharm.
2). How to create a python project and how to edit configurations in PyCharm?
3). How to add interpreter using PyCharm?
4). Creating a new python file in python project and executing the file using Run command.
Python program to loop through a list of numbers and print it
#Write a code to loop through a list of numbers and print it using python
numbers = [10, 20, 30, 40, 50]
for x in numbers:
print(x)

Print the following string by using escape characters : We are “VIKINGS” of the north.
# Print the following string by using escape characters : We are "VIKINGS" of the north. a="we are \"VIKINGS\" of the north." print(a)
Python program to Print the length of the string ‘programmer’
# program to print length of the string 'programmer'
a="programmer"
print(len(a))
#otherway to print length of the string 'programmer'
#print(len("programmer"))

Python program to Declare 10 variables and perform arithmetic operations(Exponential, Modulus and Floor Division) on them.
# Declare 10 variables and perform arithmetic operations(Exponential, Modulus and Floor Division) on them. a=1 b=2 c=3 d=4 e=5 f=6 g=7 h=8 i=9 j=10 #Exponential operation x=(j**a) y=(x**b) print(y) #Modulus operation z=(d%c) print(z) #floor division fd=(g//f) print(fd)![]()
Python program to Declare 10 variables and perform arithmetic operations(Addition,Multiplication,Division) on them.
# Declare 10 variables and perform arithmetic operations(Addition,Multiplication,Division) on them. a=5 b=10 c=15 d=20 e=25 f=30 g=35 h=40 i=45 j=50 #addition sum=a+b+c+d+e+f+g+h+i+j print(sum) #Multiplication y=(a*b) print(y) #division z=(j/a) print(z)Results:-
Python program to print a statement “Hello,Darkness”
#program to print hello darkness
print("Hello,darkness")
#a="Hello,darkness"
#print(a)

Write a code to print a Fibonacci series upto the nth term. Use the int(input()) to get an input from the user as well for the value of n.)
#Write a code to print a Fibonacci series upto the nth term. Use the int(input()) to get an input from the user as well for the value of n.)
x = int(input("enter number of terms in the fibonacci series: "))
def fibonacci1(x):
n1 = 0
n2 = 1
sum1 = 0
if x <=0:
print("please enter a number greater than 0")
else:
for i in range(0, x):
print(sum1, end=" ")
n1 = n2
n2 = sum1
sum1 = n1 + n2
fibonacci1(x)
Write a code using a function to check whether a given number is prime number or not
#Write a code using a function to check whether a given number is prime number or not
x= int(input("enter a number: "))
def primeornot(x):
if x <= 1:
print("1 is not a prime number ")
elif x == 2:
print("2 is a prime number")
elif x == 3:
print("3 is a prime number")
else :
if x%2 == 0 or x%3 == 0 or x%5 == 0 or x%6 == 0 :
print("Given number is not a prime number")
else :
print(" Given number is a prime number")
primeornot(x)

Program to check whether a given number is even or odd using a function
#Write a code using a function to check whether a given number is even or odd
x= int(input("enter a number: "))
def evenorodd(x):
if x == 0:
print("0 is neither odd nor even ")
elif x%2 == 0:
print("Given number is even ")
else :
print("Given number is odd ")
evenorodd(x)





Results:-
