count=0
from random import randint
for i in range (1,10001):
dice1=randint(1,6)
dice2=randint(1,6)
if dice1==dice2:
count+=1
percent=(count/10000)*100
print(f"The doubles percentage is {percent}%")
The doubles percentage is 15.98%
num=int(input("enter a number: "))
if num>=1 and num<=100:
print("The number falls in the range")
else:
print("The number falls outside the range")
enter a number: 102 the number falls outside the range
num=int(input("enter a number: "))
if num in range(1,101,1):
print("The number is in the range")
else:
print("The number is not in the range")
enter a number: 101 not in range
num=int(input("enter a number: "))
for i in range(1,101,1):
if num==i:
x=true
break
else:
x=false
if x==true:
print("The number is in the range")
else:
print("The number is not in the range")
enter a number: 101 not in the range
cards=int(input("How many cards are you holding? "))
rem=cards//2
print(f"Your hand would reduce to {rem}")
How many cards are you holding? 99 Your hand would reduce to 49
from random import randint
num=int(input("enter a positive integer: "))
if num>=1:
x=randint(num,num+10)
else:
print("please enter a valid input")
print("A"*x)
enter a positive integer: 3 AAA
start=int(input("enter the start time in 24 hour format: "))
end=int(input("enter the end time in 24 hour format: "))
if start<end:
time=end-start
else:
time=24-(start-end)
bill=time*5.50
print("Your total bill is", bill)
enter the start time in 24 hour format: 23 enter the end time in 24 hour format: 20 Your total bill is 115.5