Latihan Program Sederhana pada Python 3.7

Ini adalah beberapa contoh pemrograman python versi 3.7

#Challenge 001
fn = str(input(“Firstname : “))
sn = str(input(“Surname   : “))
print(“Hello”, fn, sn)


#Challenge 002

n1 = str(input(“Please enter three number : “))
n2 = n1[0]
n3 = n1[1]
n4 = n1[2]
n5 = int(n2)
n6 = int(n3)
n7 = int(n4)
n8 = (n5 + n6) * n7
print(“The answer is”, n8)

#Challenge 003
name = str(input(“Name : “))
age = int(input(“Age : “))
new = age + 1
print(name, “next birthday you will be”, new)

#Challenge 004

tag = int(input(“Total Price : Rp. “))
user = int(input(“Number of diners : “))
print(“—————————-“)
pay = tag / user
print(“Paid for person is Rp. “,pay)

#Challenge 007
kg = float(input(“Input your weight (kg) : “))
gr = kg * 1000
print(“Weight : “, gr, “grams”)

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *