0

Python Beginner Help

""" Given the input of the total number of houses that you visited, what is the percentage chance that one random item pulled from your bag is a dollar bill? """ houses = int(input()) #your code goes here x = houses/2 y= (((houses/x))/houses)*100 v =round(y) print(v) """ Runs corrctly. However, i feel there can be more to it. PS. i'm just a beginner. """

6th Oct 2022, 10:11 AM
Djwerter Richmond
Djwerter Richmond - avatar
4 Respuestas
+ 3
import math houses = int(input()) a=(2/houses)*100 print(math.ceil(a)) This one too works...try this too
6th Oct 2022, 11:06 AM
Venkatesh
Venkatesh - avatar
+ 1
Emerson Prado typing mistake...
7th Oct 2022, 4:27 AM
Venkatesh
Venkatesh - avatar
0
Djwerter Richmond What's the logic behind the calculations? You seem to output round(200/houses), but with lots of extra steps. Why?
7th Oct 2022, 1:47 AM
Emerson Prado
Emerson Prado - avatar
0
Arun Venkatesh.N In fact, your code has a syntax error: wrong indentation in line 3
7th Oct 2022, 1:48 AM
Emerson Prado
Emerson Prado - avatar