Qudas
Diamond Üye
- Katılım
- 27 Şub 2020
- Mesajlar
- 360
- Beğeniler
- 45
# define Reservation class
class Reservation:
def __init__(self, date_time, duration, breed, num_dogs):
self.date_time = date_time
self.duration = duration
self.breed = breed
self.num_dogs = num_dogs
def get_price(self):
return self.duration * 10 + self.num_dogs * 5
# get user input
date_time = input("Enter date and time (DD/MM/YYYY): ")
duration = int(input("Enter duration in hours: "))
breed = input("Enter breed: ")
num_dogs = int(input("Enter number of dogs: "))
# make reservation and calculate price
reservation = Reservation(date_time, duration, breed, num_dogs)
price = reservation.get_price()
# display reservation and price
print(f"Reservation successful for {num_dogs} {breed}(s) on {date_time} for {duration} hours.")
print(f"Total price: ${price}")
import random
def makename():
a = ["Your dog walkers is: ali", "Your dog walkers is: patric","Your dog walkers is: robert", "Your dog walkers is: anais",
"Your dog walkers is: charlie", "Your dog walkers is: katarina", "Your dog walkers is: rock", "Your dog walkers is: Kelvin", "Your dog walkers is: Craig", "Your dog walkers is: alex", "Your dog walkers is: Abel"]
p = ["Collins", "Smith", "Koç", "Hill", "Glory", "Carney", "Gav"]
return "{} {}".format(random.choice(a), random.choice(p))
for i in range(1):
print(makename())
Arkdaşlar böyle bi kodum var sadece date_time = input("Enter date and time (DD/MM/YYYY): ") Bu kısma eğer 2023 en düşük bi sayı girilirse program 2023 den dah düşük bir sayı giremezsiniz desin bunu yapabilecek var mı
class Reservation:
def __init__(self, date_time, duration, breed, num_dogs):
self.date_time = date_time
self.duration = duration
self.breed = breed
self.num_dogs = num_dogs
def get_price(self):
return self.duration * 10 + self.num_dogs * 5
# get user input
date_time = input("Enter date and time (DD/MM/YYYY): ")
duration = int(input("Enter duration in hours: "))
breed = input("Enter breed: ")
num_dogs = int(input("Enter number of dogs: "))
# make reservation and calculate price
reservation = Reservation(date_time, duration, breed, num_dogs)
price = reservation.get_price()
# display reservation and price
print(f"Reservation successful for {num_dogs} {breed}(s) on {date_time} for {duration} hours.")
print(f"Total price: ${price}")
import random
def makename():
a = ["Your dog walkers is: ali", "Your dog walkers is: patric","Your dog walkers is: robert", "Your dog walkers is: anais",
"Your dog walkers is: charlie", "Your dog walkers is: katarina", "Your dog walkers is: rock", "Your dog walkers is: Kelvin", "Your dog walkers is: Craig", "Your dog walkers is: alex", "Your dog walkers is: Abel"]
p = ["Collins", "Smith", "Koç", "Hill", "Glory", "Carney", "Gav"]
return "{} {}".format(random.choice(a), random.choice(p))
for i in range(1):
print(makename())
Arkdaşlar böyle bi kodum var sadece date_time = input("Enter date and time (DD/MM/YYYY): ") Bu kısma eğer 2023 en düşük bi sayı girilirse program 2023 den dah düşük bir sayı giremezsiniz desin bunu yapabilecek var mı