Untitled1.Ipynb - Colab
Untitled1.Ipynb - Colab
ipynb - Colab
N=input("Name:")
A=int(input("age:"))
Rage=60-A
print("Name : ",N)
print("age : ",A)
print("retirement ; ",Rage)
N=int(input("Number:"))
N1=N*1
N2=N*2
N3=N*3
N4=N*4
N5=N*5
print("N*1 : ",N1)
print("N*2 :",N2)
print("N*3 :",N3)
print("N*4 :",N4)
print("N*5 :",N5 )
Number:1
N*1 : 1
N*2 : 2
N*3 : 3
N*4 : 4
N*5 : 5
a=int(input("first number:"))
b=int(input("second number:" ))
a,b=b,a
print("the value of a after sw:",a)
print("the value of b",b)
first number:3
second number:4
the value of a: 4
the value of b 3
n=input("productname:")
p=int(input("price:"))
q=int(input("quantity:"))
g=int(input("gst:"))
https://colab.research.google.com/drive/16y2Gn3rI2i7NwtPk1zNM34V_jvb9nZTw 1/4
23/01/2025, 18:40 Untitled1.ipynb - Colab
d=int(input("discount:"))
price=p
quantity=q
amount=p*q
gst=g
discount=d
totalamount=pramount + gst/100*amount
netcost=totalamount-discount
print("totalamount=amount+gst/amount*100",totalamount)
print("netcost=totalamount-discount",netcost)
productname:a
price:1
quantity:10
gst:5
discount:0
totalamount=amount+gst/amount*100 10.5
netcost=totalamount-discount 10.5
n=int(input("enter age,"))
a=(18)
if n>=a :
print("You are eligible to vote")
else :
print("You are not eligible to vote")
n=int(input("enter number"))
a=1
if n>=1 :
print("number is positive")
else:
print("number is negative")
enter number-1
number is negative
n=int(input("enter number"))
a=9
b=99
if 10<a>=1 :
print("it is one digit number")
else:
print("it is two digit number")
enter number43
it is two digit number
another number13
WAP to accept items name price and quantity.calculate value,gst and netprice
https://colab.research.google.com/drive/16y2Gn3rI2i7NwtPk1zNM34V_jvb9nZTw 2/4
23/01/2025, 18:40 Untitled1.ipynb - Colab
value=price*quantity
Gst=18/100*value
netprice=value+Gst
print("value",value)
print("Gst",Gst)
print("netprice",netprice)
wap to accept name and marks obtained of a student check pass or fail
wap to accept name and marks of 5 subjects find total and also display pass or fail
https://colab.research.google.com/drive/16y2Gn3rI2i7NwtPk1zNM34V_jvb9nZTw 3/4
23/01/2025, 18:40 Untitled1.ipynb - Colab
wap to make a guese game .generate a random number between 1 to 9 ask user to enter a number if it matches the random number
import random
R=random.randint(1,9)
N=int(input("enter number"))
if R==N :
print("win")
else :
print("loss")
import random
L=["rock", "paper", "scissor"]
N=input("enter your choice")
x=random.randint(0,2)
if N==L[x]:
print("tie")
elif N=="rock" and L[x]=="paper":
print("you win")
elif N=="paper" and L[x]=="scissor":
print("you win ")
elif N=="scissor" and L[x]=="rock":
print("you win")
elif N=="paper" and L[x]=="rock":
print("you lose")
elif N=="scissor" and L[x]=="paper":
print("you lose")
elif N=="rock" and L[x]=="scissor":
print("you lose")
else:
print("invalid choice")
https://colab.research.google.com/drive/16y2Gn3rI2i7NwtPk1zNM34V_jvb9nZTw 4/4