Hour of Python - Coding Challenge 7 | Number of Things

preview_player
Показать описание
Enroll for exercises, tutorials, courses, and projects...

Enroll in Learn Python™ course

==================================================
Connect With Me!

Snapchat ► Rafeh1

Creative Commons — Attribution 3.0 Unported— CC BY 3.0
Рекомендации по теме
Комментарии
Автор

Just got a small internship due to my Scratch and Python knowledge! Thanks dude

shobhit
Автор

These challenges are awesome, give us more :D, it's amazing

vittoriovicevic
Автор

def how_many(the_list):
if the_list[0] == 1:
return 'There is {} {}'.format(the_list[0], the_list[1])
else:
return 'There are {} {}s'.format(the_list[0], the_list[1])
return the_list
print(how_many([1, 'trinket']))
print(how_many([5, 'King']))
#This is a cleaner way than any other.

basedman
Автор

Hello cleverprogramer, thank you for making this video, It's awesome..

dailyblackheads
Автор

def how_meany(number, string):
sent = 'There are '
number = int(number)
if number > 1:
string = string[0:] + 's.'
elif number == 1:
sent = 'There is '
return sent + str(number)+ ' ' + string
print(how_meany(2, 'king'))

Hi-knkv
Автор

def formating(from_list):
if from_list[0]== 1:
return "There is " + str(from_list[0]) + ' ' +from_list[1]
else:
return "There are "+ str(from_list[0]) + ' '+ from_list[1] +'s.'

print (formating([1, 'king']))
print (formating([5, 'monkey']))

isratjahan
Автор

sir I went to clever programmer and enrolled in free python beginner's course but I can't find any repl it links in exercise 1
cannot see comments area or any conversations
please respond

mrrdnklsxnon-other
Автор

Hello.

So I installed Python 3 and could do simple stuff with it like printing or using the calculator. But I could not find the "scripts" folder nor can I find the Python36 folder in my C driver (Im using Windows). I installed Python 2 and everything went better. I was able to install stuff like Pip, create the path for python and so on.

Why is that? Should I resort to Python 2 and leave 3?

Thank you.

MyName-bwkz
Автор

Hello. How did you get started with the YouTube channel?

emperorofanatolia
Автор

def number_of_things(list_):
if list_[0] > 1:
return "There are {} {}s.".format(list_[0], list_[1])
else:
return "There is {} {}.".format(list_[0], list_[1])

print(number_of_things([1, 'banana']))
print(number_of_things([7, 'banana']))

dvorapat
Автор

Qazi please re open your python course! I want to learn Python!! 🙏🙏

btmahola
Автор

Where is your oop course?. I cannot find it!

basedman
Автор

hi, ill be going to college in few weeks pursuing geuss what, and my curriculum starts with c so i started with geuss what, im a hugeass beginner so i have this question ? i have an idea for this social networking site ( go ahead gudge me ) what languages do i need to learn to build a beautiful geuss what and also i want the app to be ultra smooth on even low end android devices ( ios one just needs to be smooth) it would be really helpful if you responded
also i know this is completely irrelevant #askqazi

kislaykunal
Автор

What if the thing is "city" or "watch"? Would we just use a bunch of "if" statements then?

buixuanbaodanh
Автор

def how_many(given_list):
if (given_list[0]==1):
return "There is 1 {}.".format(given_list[1])
else:
return "There are {} {}s".format(given_list[0], given_list[1])

gorkemcelebiler
Автор

very useful thx.... any explanations about == += -= ....

amjadalhosaini
Автор

def how_many(list):
if list[0] == 1 :
sentence = 'There %s %s %s.'%('is', list[0], list[1])
print sentence
elif list[0] >= 2:
sentence = 'There %s %s %s.'%('are', list[0], list[1]+'s')
print sentence

print how_many([5, "Trinkets"])
print how_many([1, "King"])

shreshthkaushik
Автор

what is more important critical thinking or memorizing??my science teacher says science is 60 percent memorizing and 40 percent critical thinking.

minoriruba
Автор

here is my solution
def how_many(the_list):

if the_list[0]>1:
return 'there are %s %ss.' %(the_list[0], the_list[1])
else:
return 'there is %s %s.' %(the_list[0], the_list[1])


return the_list



print(how_many([5, 'trinket']))
print(how_many([1, 'king']))

ermiaskidanegebre
Автор

One line version.

return "There are " + str(the_list[0]) + " " + the_list[1] + "s." if (the_list[0] > 1) else "There is " + str(the_list[0]) + " " + the_list[1] + '.'

lochnload
welcome to shbcf.ru