0% found this document useful (0 votes)
2 views2 pages

Python Learning

The document provides an overview of Python programming concepts including variable assignment, conditional statements (if, elif, else), loops, functions, and data structures. It includes examples demonstrating how to use these concepts, such as printing values, checking conditions, and defining functions. Additionally, it showcases the use of comments and basic output formatting.

Uploaded by

kelyse287
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Python Learning

The document provides an overview of Python programming concepts including variable assignment, conditional statements (if, elif, else), loops, functions, and data structures. It includes examples demonstrating how to use these concepts, such as printing values, checking conditions, and defining functions. Additionally, it showcases the use of comments and basic output formatting.

Uploaded by

kelyse287
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Python learning

x=”john”
Y=”collage”
Print( x, y, sep=’\n’)//out put john
Collage
Print( x, y, sep=’\t’)//out put john collage

condition
IF ELSE
X=33
Y=33 OUT PUT
If a>b:
Print(“a is greater than”)
Else:
Print(“b is greater than”)

IF ELIF ELSE

1
Output
x = 10
Y=4
x is greater than Y
if x > Y:
print("x is greater than Y")
Elif x == 10:
print("x is equal to Y")
else:
print("x is less than Y ")

2.
temperature = 15 Output
It's mild. Is nice day
if temperature > 30:
print("It's hot!")
Elif temperature < 15:
print("It's cold!")
else:
print("It's mild. Is nice day")

3.
age = 20
Output
if age >= 18: Allowed to vote
print("Allowed to vote.")
else:
print("Not allowed to vote.")
4.
m = 85

if m >= 90:
grade = 'A'
elif m >= 80: Output
grade = 'B' Grade: B
elif m >= 70:
grade = 'C'
elif m >= 60:
grade = 'D'
else:
grade = 'F'

print("Grade:", grade)

# This is a comment
print("Hello, World!") # Output: Hello, World!

# Variables
x = 10
y = 5.5
name = "Alice"

# Data Structures
numbers = [1, 2, 3, 4, 5] # List
person = {"name": "Alice", "age": 30} # Dictionary

# Conditional Statements
if x > y:
print("x is greater than y")
else:
print("y is greater than or equal to x")

# Loops
for number in numbers:
print(number)

# Functions
def greet(name):
return f"Hello, {name}!"

print(greet("Alice"))

You might also like