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

Python

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

Python

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

#single commend

"""
This is a multi-line comment.
It can span multiple lines.
It is often used for documentation or for longer explanations.
"""
"""
#sequential
cm = float(input("Enter cm:"))
meters = cm/100
print(meters)"""

"""word = str(input("Enter a word:"))


print(word)
"""
"""
#condtional
math = float(input("Enter Math Grade:"))
english = float(input("Enter English Grade:"))
science = float(input("Enter Science Grade:"))
filipino = float(input("Enter Filipino Grade:"))

average = (math + english + science + filipino)/4

#if statement
if average >=70:
print(f"Your average {average} is Passed")
else:
print(f"Your average {average} is Failed")

#switch case but match in python


match average:
case average if average >=70:
print(f"Your average {average} is Passed")
case _:
print(f"Your average {average} is Failed")
"""
"""
number = int(input("Enter a number:"))

#for loop
for i in range(1,number+1):
print("Helooo")
#for loop with conditional
print("Even numbers: ", end=" ")
for i in range(1,number + 1):
if i % 2 == 0 :
print(i, end=" ")
"""
"""
#while loop
x = 1
while x <= number:
print(x, end=" ")
x+=1
"""

"""
#while loop conditional
x=1
while x <= number:
if x % 2==0:
print(x, end=" ")
x +=1
"""

"""
y=1
#do-while loop
while True:
print(y, end=" ")
y +=1
if y >number:
break
"""

#do while loop conditional


y=1
while True:
if y % 2 ==0:
print(y, end=" ")
y+=1
if y > number:
break

You might also like