Python Basics: Exercise!

preview_player
Показать описание
Time for some programming challenges. Try out everything you've learnt so far and learn even more of Python on your way.

First watch my Python Basics playlist:

and then start to code! I'm curious how it will go.

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

please keep making these videos, you explain really clearly and so well than anyone in YouTube i have come across maybe you could make your next video about while loops?please?

ytp
Автор

This is how I wrote it:

def convert():
Convert=""
Convert = float(input('Please enter inches to convert to centermeters: '))
answer = Convert * 2.54
print('This measurement is', answer, 'cm')
ask=""
while ask !='Y' and ask !='N':
ask=input('Do you want to find another one out? ')

if ask =='Y':
convert()
else:
ask =='N'
print('Thank you goodbye')

return convert

convert()

It isn't perfect as it still causes an error if someone does not enter a number at the start, but after 2 weeks of learning im happy :) Thank you Ola

michaelhearmon
Автор

Hi Ola,

Happy New Year! Thank you for your videos, I just started my adventure with coding and your lectures are very helpful :D.

Mastafaja
Автор

def inch_cm():
    try:
        user=int(input('Please enter the number: '))
        result = user*2.54
        return ('{} inches is {} cm'.format(user, result))
    except:
        return 'Sorry!!!, Please enter a number only'
print(inch_cm())

santoshpaul