Thursday, February 20, 2020

birthday

birthday

theme = input("what is your birthday theme? ")
main_color = input("What is your main color? ")
guests_number = int(input("How many people are you inviting? "))

guests_name = []

for i in range(guests_number):
    message = "Please enter guest " + str(i + 1) + " name: "
    name = input(message)
    guests_name.append(name)
   

print("My birthday theme is " + theme)
print("My main color for the birthday is " + main_color)

for guest in guests_name:
    print("I would like to invite " + guest + " to come to my birthday on may 13th.")
   
   
print("I am looking forward to seeing you in my party :) :)")

Sunday, January 12, 2020

new year resolutions

def make_resolutions():
    year = input("What is the year?")
    number_of_goal = int(input("How many goals do you want to set for this yea?"))

    goals = list()
    # goals = []
    for i in range(number_of_goal):
        goal = input("Please enter your goal: ")
        goals.append(goal)


    print("\nHere is the resolutions for year ", year)
    print("---------------------------")
    for goal in goals:
        print(goal)

make_resolutions()

Wednesday, January 1, 2020

casino

import random

betters = []

number_of_people_str = input("How many people are betting? ")
number_of_people = int(number_of_people_str)

for better in range(number_of_people):
    betters.append(input("Enter the name of better: "))

betters.append("Casino")


amount_to_bet = int(input("How much do you want to bet? "))

round_to_bet = int(input("How many time do you want to bet? "))

total_amount = number_of_people * amount_to_bet


for round in range(round_to_bet):
    random_winner = random.randint(0,number_of_people)
    print(betters[random_winner]," won " ,total_amount)

Friday, December 20, 2019

money converter

def dollars_to_euros(amount):
    return amount * .9


def euro_to_dollar(amount):
    return amount * 1.11


print(dollars_to_euros(1))

print(euro_to_dollar(100))

class lesson person and car

class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age


def print_person(person):
    print("My name is ",person.name, " and i am " ,person.age, " years old")

ali = Person("ali", 43)

print_person(ali)
     
sonia = Person("sonia", 8)

print_person(sonia)

mum = Person("Solmaz", 37)

print_person(mum)






class Car:
  def __init__(self,name, color):
      self.name = name
      self.color = color
 

def print_car(car):
    print("I am a ", car.color, " ", car.name, " car.")

rusty = Car("Rusty", "Gray")
mum_car = Car("Mum", "Gray")
sonia_car = Car("pinkyyyyy", "Pink")
tina_car = Car("yellowwww","yellow")

print_car(rusty)
print_car(mum_car)
print_car(sonia_car)
print_car(tina_car)

Wednesday, December 18, 2019

car registration number

import string

import random



def register_car_number():

    alphabet = list(string.ascii_uppercase)

#     ["A","B",....,"Z"]

    

    letter1 = alphabet[random.randint(0,26)]

    letter2 = alphabet[random.randint(0,26)]

    letter3 = alphabet[random.randint(0,26)]

    

    num1 = random.randint(0,9)

    num2 = random.randint(0,9)

    num3 = random.randint(0,9)

    



    month = input("Please enter the month the car is made ")

    year = input("Please enter the year the car is made ")



    car_number = letter1 + letter2 + letter3 +" " + month + " " + year + " "+ str(num1) + str(num2) + str(num3)

    print("Here is your car registeration number: ", car_number )



    

    

register_car_number()



    

Thursday, December 12, 2019

christmas whishes game

christmas_wishes = ["bicycle","teddy bear", "ball"]
scrambled_words = ["cylebi","rabe yddet","lbal"]

def play():
    for position, word in enumerate(scrambled_words):
        guess = input("Guess what is this scrambled word: "+ word)
       
        if position == 0:
            if guess == christmas_wishes[0]:
                print("Correct answer: ", guess)
            else:
                print("Sorry you were wrong")
        elif position == 1:
            if guess == christmas_wishes[1]:
                 print("Correct answer: ", guess)
            else:
                 print("Sorry you were wrong")
        else:
            if guess == christmas_wishes[2]:
                 print("Correct answer: ", guess)
            else:
                 print("Sorry you were wrong")
                     
                     
                     
                     
play()