Python Doc (Input and Output)
Python Doc (Input and Output)
INPUT
if number > 0:
else:
OUTPUT
Enter a number: 50
INPUT
if (num%2) == 0:
else:
OUTPUT
Enter a number: 15
15 is odd number
Enter a number: 30
30 is even number
3) INTEGER NUMBER
INPUT
a=int(input("Enter A: "))
b=int(input("Enter B: "))
c=int(input("Enter C: "))
if a>b:
if a>c:
g=a
else:
g=c
else:
if b>c:
g=b
else:
g=c
print("Greater = ",g)
OUTPUT
Enter A: -50
Enter B: -100
Enter C: 0
Greater = 0
4) SUBJECT MARKS
INPUT
else:
OUTPUT
INPUT
a=int(input("Enter A: "))
b=int(input("Enter B: "))
c=int(input("Enter C: "))
else:
print(c,"is greater")
OUTPUT
Enter A: 50
Enter B: 45
Enter C: 40
50 is greater
Enter A: 100
Enter B: 300
Enter C: 250
300 is greater
Enter A: 5
Enter B: 50
Enter C: 500
500 is greater
INPUT
OUTPUT
INPUT
else:
OUTPUT
INPUT
year = int (input("Enter a year"))
else:
(OUTPUT)
Enter a year:2000
9) QUANTITY
INPUT
if qty<=2:
else:
OUTPUT
Total cost=INR: 20
INPUT
import turtle
toto=turtle.Turtle()
toto.shape("turtle")
toto.screen.bgcolor("light blue")
toto.color("green")
r=10
for i in range(100):
toto.circle(r+i,60)
turtle.done()
OUTPUT
11)DRAW A PENTAGON
INPUT
# draw pentagon in Python Turtle
import turtle
toto=turtle.Turtle()
toto.shape("turtle")
toto.screen.bgcolor("light blue")
toto.color("green")
for i in range(5):
toto.forward(100)
toto.left(72)
turtle.done()
OUTPUT
INPUT
import turtle
toto=turtle.Turtle()
toto.shape("turtle")
toto.screen.bgcolor("light blue")
toto.color("green")
for i in range(3):
toto.forward(100)
toto.left(120)
turtle.done()
OUTPUT
INPUT
import turtle
toto=turtle.Turtle() toto.right(90)
toto.right(90) toto.forward(45)
toto.forward(45) OUTPUT
toto.right(90)
toto.forward(45)
toto.right(90)
toto.forward(45)
output :
INPUT
if num >= 0:
else:
OUTPUT
Enter a number: 5
Enter a number: -5
15) GRADES
INPUT
print("Grade = A ")
print("Grade = B ")
print("Grade = C ")
elif per>= 50 and per<=59:
print("Grade = D ")
print("Grade = E ")
else:
print("Grade = F ")
OUTPUT
Grade = A
Grade = F
CHARACTER
INPUT
else:
OUTPUT
Enter a character: a
Enter a character: T
Entered character is an alphabet
Enter a character: 8
Enter a character: $
INPUT
import turtle
toto= turtle.Turtle()
toto.shape("turtle")
toto.screen.bgcolor("light blue")
toto.color('red')
toto.begin_fill()
toto.fillcolor("purple")
for i in range(5):
toto.forward(200)
toto.right(144)
toto.end_fill()
turtle.done()
OUTPUT
All the best