Home Federal Savings Bank -Problem Set 1 (CS50's Introduction to Programming with Python)

preview_player
Показать описание
Hello, everyone and welcome to another video, in this video, I will explain and solve problem set 1, Home Federal Savings Bank.

if you haven't already submitted this problem, You have to try this on your own.
This video is to just give you a way to solve this problem , try solving it using a different approach, to get the most benefits out of this experience.

Don't forget to hit the like button and subscribe to the channel, and if you have any questions or want an explanation for a specific problem leave a comment down below.

Рекомендации по теме
Комментарии
Автор

brilliant content, i adapted using another form

greeting = input ("Greeting: ").lower().strip()
if greeting == "hello" or
print ("0$")
elif greeting.startswith("h"):
print ("20$")
else:
print ("100$")

Andrew-yvvd
Автор

def main():
x = input("Greeting: ").lower().strip()
if a(x):
print("$0")
elif b(x):
print("$20")
else:
print("$100")

def a(hello):
return hello.startswith("hello")

def b(h):
return h and h[0] == "h"

main()

rafaellr
Автор

#this is not working for me can you tell me why?
def main():
greeting = input("Greeting: ").lower().strip()

match greeting:
case "hello":
print("0$")
case
print("0$")
case greeting.startswith("h"):
print("20$")
case _ :
print("100$")

main()

#this is not working for me can you tell me why?

ce-rflg
Автор

greeting=input("Greeting: ")
if ('Hello' in greeting):
print("$0")
elif 'How' or 'Hey' in greeting:
print("$20")
else:
print("$100"

Will this work?

rahulvidwans
Автор

i found another solutiuon using the .startswith

text=(input('Greeting: ')).lower().replace(' ', '')

if text.startswith('hello') is True:
print('$0')
elif text.startswith('h') is True:
print('$20')
else:
print('$100')

jdubiez
visit shbcf.ru