This document discusses different types of comments in Python code. It explains that comments are useful notes for developers and end users to understand the code. There are two types of comments in Python: single line comments which start with a # symbol and multi-line comments which are enclosed between triple quotation marks. The document also provides examples of each type of comment.
Kosmik is the best institute for Python training in Hyderabad Kukatpally/KPHB. kosmik provides lab facilities with complete real-time training with live sessions
call now: +91-8712186898, +91-8179496603, +91-6309565721
Kosmik is the best institute for Python training in Hyderabad Kukatpally/KPHB. kosmik provides lab facilities with complete real-time training with live sessions
call now: +91-8712186898, +91-8179496603, +91-6309565721
After the end of lesson you will be able to learn Python basics-What Python is? Its releases. Where we can use Python? Python Features. Tokens, comments variables etc... In out next PPT you will learn how to input and get output in Python
Excellence Academy Is The Renowned & Best Python Training Institute In Chandigarh That Provides 100% Job-Oriented .Python Training Institute In Mohali Our Course Is Designed Especially For Students, Housewives & Other Who Are Looking For Python Training In Chandigarh.
Excellence Academy Is The Renowned & Best Python Training Institute In Chandigarh That Provides 100% Job-Oriented .Python Training Institute In Mohali Our Course Is Designed Especially For Students, Housewives & Other Who Are Looking For Python Training In Chandigarh.
CBSE Class 12 Computer practical Python Programs and MYSQL Rishabh-Rawat
This upload is my Computer Science Practical File for CBSE class 12 Board exam practical.
Some errors in the displaying of the content might have crept in as I prepared this file on my android. ;P
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdfaishwaryaequipment
Code In Python
File 1: main.py
You will implement two algorithms to find the shortest path in a graph.
1. def dijkstra(G,start_node): Takes an Adjacency Matrix G and the index of the starting
node start_node. Returns the distance array.
2. def floyd(G): Takes an Adjacency Matrix G and returns the distance matrix
The graph you are working on will be give in a file with the following format.
1. Line 1: The number of Nodes in the Graph
2. Lines 2-EOF: Every other line in the file contains an edge
1. First Value is the FROM node
2. Second Value is the TO node
3. Third Value is the weight of the edge
Note: You should store the weights as floats.
The program will have a command line interface. First ask for the file name of the graph to work
with. Then implement 4 text commands.
· dijkstra x - Runs Dijkstra starting at node X. X must be an integer
· floyd - Runs Floyd\'s algorithm
· help - prints this menu
· exit or ctrl-D - Exist the program
You must implement this using only standard python3 libraries. You may not use any outside
libraries. For example, open source graph libraries. Your code must run on tux with just main.py
and the input files. You may not include any other python files.
Example Run 1
File containing graph: input1.txt
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: help
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: dijkstra 0
[0.0, 1.0, 3.0, 5.0, 7.0]
Enter command: exit
Bye
Example Run 2
File containing graph: input1.txt
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: dijkstra 0
[0.0, 1.0, 3.0, 5.0, 7.0]
Enter command: dijkstra 1
[inf, 0.0, 2.0, 4.0, 6.0]
Enter command: dijkstra 2
[inf, 3.0, 0.0, 2.0, 4.0]
Enter command: dijkstra 3
[inf, 1.0, 3.0, 0.0, 7.0]
Enter command: dijkstra 4
[inf, 6.0, 8.0, 5.0, 0.0]
Enter command: exit
Bye
Example Run 3
File containing graph: input1.txt
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: floyd
[0.0, 1.0, 3.0, 5.0, 7.0]
[inf, 0.0, 2.0, 4.0, 6.0]
[inf, 3.0, 0.0, 2.0, 4.0]
[inf, 1.0, 3.0, 0.0, 7.0]
[inf, 6.0, 8.0, 5.0, 0.0]
Enter command: exit
Bye
Example Run 4
File containing graph: input2.txt
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: dijkstra 0
[0.0, 3.0, 4.0, 4.0, inf, 4.0]
Enter command: dijkstra 1
[inf, 0.0, 1.0, 3.0, inf, 1.0]
Enter command: dijkst.
After the end of lesson you will be able to learn Python basics-What Python is? Its releases. Where we can use Python? Python Features. Tokens, comments variables etc... In out next PPT you will learn how to input and get output in Python
Excellence Academy Is The Renowned & Best Python Training Institute In Chandigarh That Provides 100% Job-Oriented .Python Training Institute In Mohali Our Course Is Designed Especially For Students, Housewives & Other Who Are Looking For Python Training In Chandigarh.
Excellence Academy Is The Renowned & Best Python Training Institute In Chandigarh That Provides 100% Job-Oriented .Python Training Institute In Mohali Our Course Is Designed Especially For Students, Housewives & Other Who Are Looking For Python Training In Chandigarh.
CBSE Class 12 Computer practical Python Programs and MYSQL Rishabh-Rawat
This upload is my Computer Science Practical File for CBSE class 12 Board exam practical.
Some errors in the displaying of the content might have crept in as I prepared this file on my android. ;P
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdfaishwaryaequipment
Code In Python
File 1: main.py
You will implement two algorithms to find the shortest path in a graph.
1. def dijkstra(G,start_node): Takes an Adjacency Matrix G and the index of the starting
node start_node. Returns the distance array.
2. def floyd(G): Takes an Adjacency Matrix G and returns the distance matrix
The graph you are working on will be give in a file with the following format.
1. Line 1: The number of Nodes in the Graph
2. Lines 2-EOF: Every other line in the file contains an edge
1. First Value is the FROM node
2. Second Value is the TO node
3. Third Value is the weight of the edge
Note: You should store the weights as floats.
The program will have a command line interface. First ask for the file name of the graph to work
with. Then implement 4 text commands.
· dijkstra x - Runs Dijkstra starting at node X. X must be an integer
· floyd - Runs Floyd\'s algorithm
· help - prints this menu
· exit or ctrl-D - Exist the program
You must implement this using only standard python3 libraries. You may not use any outside
libraries. For example, open source graph libraries. Your code must run on tux with just main.py
and the input files. You may not include any other python files.
Example Run 1
File containing graph: input1.txt
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: help
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: dijkstra 0
[0.0, 1.0, 3.0, 5.0, 7.0]
Enter command: exit
Bye
Example Run 2
File containing graph: input1.txt
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: dijkstra 0
[0.0, 1.0, 3.0, 5.0, 7.0]
Enter command: dijkstra 1
[inf, 0.0, 2.0, 4.0, 6.0]
Enter command: dijkstra 2
[inf, 3.0, 0.0, 2.0, 4.0]
Enter command: dijkstra 3
[inf, 1.0, 3.0, 0.0, 7.0]
Enter command: dijkstra 4
[inf, 6.0, 8.0, 5.0, 0.0]
Enter command: exit
Bye
Example Run 3
File containing graph: input1.txt
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: floyd
[0.0, 1.0, 3.0, 5.0, 7.0]
[inf, 0.0, 2.0, 4.0, 6.0]
[inf, 3.0, 0.0, 2.0, 4.0]
[inf, 1.0, 3.0, 0.0, 7.0]
[inf, 6.0, 8.0, 5.0, 0.0]
Enter command: exit
Bye
Example Run 4
File containing graph: input2.txt
Possible Commands are:
dijkstra x - Runs Dijkstra starting at node X. X must be an integer
floyd - Runs Floyd\'s algorithm
help - prints this menu
exit or ctrl-D - Exits the program
Enter command: dijkstra 0
[0.0, 3.0, 4.0, 4.0, inf, 4.0]
Enter command: dijkstra 1
[inf, 0.0, 1.0, 3.0, inf, 1.0]
Enter command: dijkst.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...Levi Shapiro
Letter from the Congress of the United States regarding Anti-Semitism sent June 3rd to MIT President Sally Kornbluth, MIT Corp Chair, Mark Gorenberg
Dear Dr. Kornbluth and Mr. Gorenberg,
The US House of Representatives is deeply concerned by ongoing and pervasive acts of antisemitic
harassment and intimidation at the Massachusetts Institute of Technology (MIT). Failing to act decisively to ensure a safe learning environment for all students would be a grave dereliction of your responsibilities as President of MIT and Chair of the MIT Corporation.
This Congress will not stand idly by and allow an environment hostile to Jewish students to persist. The House believes that your institution is in violation of Title VI of the Civil Rights Act, and the inability or
unwillingness to rectify this violation through action requires accountability.
Postsecondary education is a unique opportunity for students to learn and have their ideas and beliefs challenged. However, universities receiving hundreds of millions of federal funds annually have denied
students that opportunity and have been hijacked to become venues for the promotion of terrorism, antisemitic harassment and intimidation, unlawful encampments, and in some cases, assaults and riots.
The House of Representatives will not countenance the use of federal funds to indoctrinate students into hateful, antisemitic, anti-American supporters of terrorism. Investigations into campus antisemitism by the Committee on Education and the Workforce and the Committee on Ways and Means have been expanded into a Congress-wide probe across all relevant jurisdictions to address this national crisis. The undersigned Committees will conduct oversight into the use of federal funds at MIT and its learning environment under authorities granted to each Committee.
• The Committee on Education and the Workforce has been investigating your institution since December 7, 2023. The Committee has broad jurisdiction over postsecondary education, including its compliance with Title VI of the Civil Rights Act, campus safety concerns over disruptions to the learning environment, and the awarding of federal student aid under the Higher Education Act.
• The Committee on Oversight and Accountability is investigating the sources of funding and other support flowing to groups espousing pro-Hamas propaganda and engaged in antisemitic harassment and intimidation of students. The Committee on Oversight and Accountability is the principal oversight committee of the US House of Representatives and has broad authority to investigate “any matter” at “any time” under House Rule X.
• The Committee on Ways and Means has been investigating several universities since November 15, 2023, when the Committee held a hearing entitled From Ivory Towers to Dark Corners: Investigating the Nexus Between Antisemitism, Tax-Exempt Universities, and Terror Financing. The Committee followed the hearing with letters to those institutions on January 10, 202
Acetabularia Information For Class 9 .docxvaibhavrinwa19
Acetabularia acetabulum is a single-celled green alga that in its vegetative state is morphologically differentiated into a basal rhizoid and an axially elongated stalk, which bears whorls of branching hairs. The single diploid nucleus resides in the rhizoid.
4. Comments
Comments are useful information that the developers
provide to make the reader understand the source code. It
explains the logic or a part of it used in the code. There are
two types of comment in Python:
● Single line comments: Python single line comment starts
with hashtag symbol with no white spaces.
Multi-line string as comment: Python multi-line comment
is a piece of text enclosed in a delimiter (“””) on each end
of the comment.
5.
6.
7.
8.
9.
10. Headline
Subtitle
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum gravida
placerat dictum. Sed sagittis accumsan dolor ut malesuada. Duis sit amet
placerat quam. Donec eget eros egestas nunc venenatis suscipit at at felis. Duis
sit amet placerat quam.
11. ● Deleting/Updating from a String –
● In Python, Updation or deletion of characters from a String is not allowed
because Strings are immutable. Only new strings can be reassigned to the
same name.
14. Basics of Input/Output
Input() and print()
name = input('What is your name?n') # n ---> newline ---> It causes a line
break
print(name)
When input() function executes program flow will be stopped until the user has given input.
The text or message displayed on the output screen to ask a user to enter an input value is optional
i.e. the prompt, which will be printed on the screen is optional.
Whatever you enter as input, the input function converts it into a string. if you enter an integer value
still input() function converts it into a string. You need to explicitly convert it into an integer in your
code using typecasting.
15. # Program to check input
# type in Python
num = input ("Enter number :")
print(num)
name1 = input("Enter name : ")
print(name1)
# Printing type of input value
print ("type of number", type(num))
print ("type of name", type(name1))
It will show the type of input as str
16. num = int(input("Enter a number: "))
print(num, " ", type(num))
floatNum = float(input("Enter a decimal number: "))
print(floatNum, " ", type(floatNum))
what will it show about the type of input?
17. # Python Program for
# Creation of String
# String with single quotes
print('Welcome to the GDSC HIT')
# String with double quotes
print("I'm a Abhishek Pandey")
# String with triple quotes
print(‘ ‘ ‘ I'm a 3rd year student and I live in a world of “Aliens“ ‘ ‘ ‘ )
18. # Python Program to Access
# characters of String
String1 = “Python“
# Printing First character
print(String1[0])
# Printing Last character
print(String1[-1])
19.
20. In computer programming, we use the if statement to run a block code only
when a certain condition is met.
Indentation in Python
Indentation is a very important concept of Python because
without properly indenting the Python code, you will end
up seeing IndentationError and the code will not get
compiled.
Python indentation refers to adding white space before a
statement to a particular block of code. In another word,
all the statements with the same space to the right,
belong to the same code block
If Elif Else
22. Let’s try to implement the following condition
For example, assigning grades (A, B, C) based on marks obtained by a student.
1.if the percentage is above 90, assign grade A
2.if the percentage is above 75, assign grade B
3.if the percentage is above 65, assign grade C
23. Colors, Charts, and Icons
While Loop in Python:-
In python, a while loop is used to execute a block of statements repeatedly until a given condition is satisfied.
And when the condition becomes false, the line immediately after the loop in the program is executed.
# Python program to illustrate while loop
count = 0
while (count < 3):
count = count + 1
print("Hello!")
Examples of While Loop with else statement
# Python program to illustrate
# combining else with while
count = 0
while (count < 3):
count = count + 1
print("Hello")
else:
print("In Else Block")
24. Colors, Charts, and Icons
For Loop in Python:-
For loops are used for sequential traversal. For example: traversing a list or string or array etc. In Python, there
is “for in” loop which is similar to for each loop in other languages. Let us learn how to use for in loop for
sequential traversals.
# Python program to illustrate
# Iterating over range 0 to n-1
n = 4
for i in range(0, n):
print(i)
output?
Decrementing With range():
for i in range(10, -6, -2):
print(i)
This will start at 10 and count down by 2 until you reach -6, or rather -4 because you don’t include -6.
This will start at 10 and count down by 2 until you reach -6, or rather -4 because you don’t include -6.
25. Colors, Charts, and Icons
Nested Loops:-
Python programming language allows to use one loop inside another loop.
We will use nested loop to print right angle triangle star pattern.
Let’s see how this work:
for i in range(1, 5):
for j in range(i):
print(i, end=' ')
print()
what is end here?
# ends the output with a space
print("Welcome to", end = ' ')
print("GeeksforGeeks", end= ' ')
Print statement automatically print a new line after the prompt inside it.
To prevent creating new line and to continue with same line we use end=“ ”
26. Star Patterns:-
Example:
for i in range(1, 9):
for j in range(i):
print(“*”, end=' ')
print()
Python Print Star Patterns 14 Programs
https://easycodebook.com/2021/05/python-print-star-pattern-shapes-programs/