Python Tutorial 29 - Taking User Inputs with sys.stdin.readline()

preview_player
Показать описание


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

Dude you rock! Keep up the good work. Very helpful and love your teaching style. Cheers from Australia!

cgull
Автор

Your programme can't handle decimals because you treated the price as an integer, if you had simply used the float() function instead of int() wouldn't that surely have fixed the problem?

findlaysmith
Автор

2:13 print(sys.stdin.readline())
Thank you

victorystocktv
Автор

i could get the same code with normal input method, I wonder y do we need to use the stdin method????

print('what was your meal price: ?')
meal=int(input())
print('how much do you want to tip: ?')
tip=int(input())
final_tip= meal* tip /100
print('the amount you need to tip is {} dollars'.format(final_tip))

santoshpaul
Автор

Why do i get the error "stdin" not defined? I wrote the code just like you did, I'm using python 3.9

muhsinmuhammed
Автор

What is difference between
price = int(input()) and price = int(sys.stdin.readlines())

Holovik
Автор

you're good.!!! YOU'RE VERY GOOOD!

nanabonsu
Автор

this doesn't work on "Execute Online Python"

lumpi
Автор

small mistakes are kind of distracting. Anyway thank you

dariacompati
Автор

does anyone know how to use text with sys.stdin.readline ??

mikailrizvi
Автор

wat about raw_input :p haha -  we just started learning python in softwaredevelopment and i already have a problem :( 

We need to create a class "Fractions" which is called by a other class named "Unit_fractionSubtraction" ( a Unit-test class)

-> The problem is we cant change the given class "Unit_fractionSubtraction" and make it work with our Fraction class.
It has following "setUp" method:


def setUp(self):
        self.b = Fraction(3, 2)
        self.b2 = Fraction(self.b)      #gives  a "Fraction" object as param. ..???
        self.b3 = Fraction((4, 2)
        pass


How can i make the constructor __init__ make that working that he can accept 2 values or a object. Its not like in Java where i can define multiple constructors :( help please im already stuck in the first Homework haha!
KEEP UP THE WORK !

Bseckin