This commit is contained in:
RafayAhmad7548 2024-09-09 16:59:28 +05:00
parent 2992f4f408
commit 4f46de8d00
3330 changed files with 394553 additions and 76939 deletions

View file

@ -0,0 +1,15 @@
import random
num = random.randint(1, 100)
for i in range(5):
guess = int(input('guess the number: '))
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
print('you failed the number was ', num)

View file

@ -0,0 +1,18 @@
import random
num = random.randint(1, 100)
for i in range(5):
try:
guess = int(input('guess the number: '))
except ValueError:
print('enter a number please')
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
print('you failed the number was ', num)

View file

@ -0,0 +1,19 @@
import random
num = random.randint(1, 100)
for i in range(5):
try:
guess = int(input('guess the number: '))
except ValueError:
print('enter a number please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
print('you failed the number was ', num)

View file

@ -0,0 +1,15 @@
import random
num = random.randint(1, 100)
for i in range(5):
guess = int(input('guess the number: '))
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
print('you failed the number was ', num)

View file

@ -0,0 +1,16 @@
import random
num = random.randint(1, 100)
for i in range(5):
guess = int(input('guess the number: '))
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
print('you failed the number was ', num)

View file

@ -0,0 +1,26 @@
import random
num_characters = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str):
for c in number:
if c not in num_characters:
number = number.replace(c, '')
num = random.randint(1, 100)
i = 0
while i < 5:
guess = int(input('guess the number btw 1 and 100: '))
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,19 @@
import random
num = random.randint(1, 100)
for i in range(5):
try:
guess = int(input('guess the number: '))
except ValueError:
print('enter a number please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
print('you failed the number was ', num)

View file

@ -0,0 +1,23 @@
import random
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number btw 1 and 100: '))
except ValueError:
print('enter a number please')
continue
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i = i + 1
print('you failed the number was ', num)

View file

@ -0,0 +1,28 @@
import random
num_characters = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str) -> str:
for c in number:
if c not in num_characters:
number = number.replace(c, '')
return number
num = random.randint(1, 100)
i = 0
while i < 5:
guess = int(input('guess the number btw 1 and 100: '))
guess = removeCharacters(guess)
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,23 @@
import random
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number btw 1 and 100: '))
except ValueError:
print('enter a number please')
continue
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,19 @@
import random
num = random.randint(1, 100)
for i in range(5):
try:
guess = int(input('guess the number: '))
except ValueError:
print('enter a number please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
print('you failed the number was ', num)

View file

@ -0,0 +1,12 @@
import random
num = random.randint(1, 100)
for i in range(5):
guess = input('guess the number')
if guess == num:
print('congratualtions you guessed correctly')
break
else:
print('incorrect guess try again')

View file

@ -0,0 +1,27 @@
import random
def removeCharacters(number: str):
for c in number:
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number btw 1 and 100: '))
except ValueError:
print('enter a number please')
continue
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,29 @@
import random
num_characters = ('1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str):
for c in number:
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number btw 1 and 100: '))
except ValueError:
print('enter a number please')
continue
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,14 @@
import random
num = random.randint(1, 100)
for i in range(5):
guess = input('guess the number')
if guess == num:
print('congratualtions you guessed correctly')
break
elif guess > num:
print('too high try again')
else:
print('too low try again')

View file

@ -0,0 +1,3 @@
import random
num = random.randint(1, 100)

View file

@ -0,0 +1,20 @@
import random
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number: '))
except ValueError:
print('enter a number please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i = i + 1
print('you failed the number was ', num)

View file

@ -0,0 +1,2 @@
import random

View file

@ -0,0 +1,28 @@
import random
num_characters = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str) -> str:
for c in number:
if c not in num_characters:
number = number.replace(c, '')
return number
num = random.randint(1, 100)
i = 0
while i < 5:
guess = int(input('guess the number btw 1 and 100: '))
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,2 @@
import random

View file

@ -0,0 +1 @@
{"version":1,"resource":"file:///home/rafayahmad/Stuff/Coding/Python/IDS/Assg1/q2.py","entries":[{"id":"bESg.py","timestamp":1725342468167},{"id":"de0y.py","timestamp":1725342482075},{"id":"V3DZ.py","timestamp":1725342515796},{"id":"Siog.py","timestamp":1725342606073},{"id":"UZi6.py","timestamp":1725342821122},{"id":"l9z1.py","timestamp":1725342861916},{"id":"iWR7.py","timestamp":1725342883175},{"id":"HL8Q.py","timestamp":1725342919581},{"id":"5jOS.py","timestamp":1725342950147},{"id":"E2Ar.py","timestamp":1725347094089},{"id":"BLF4.py","timestamp":1725347159945},{"id":"IdHc.py","timestamp":1725347176231},{"id":"PrjJ.py","timestamp":1725347188501},{"id":"D53Q.py","timestamp":1725347209058},{"id":"urc0.py","timestamp":1725347304274},{"id":"XG28.py","timestamp":1725347488362},{"id":"ORYk.py","timestamp":1725347575295},{"id":"PPx1.py","timestamp":1725347814755},{"id":"TBwj.py","timestamp":1725348680732},{"id":"UQvG.py","timestamp":1725348734996},{"id":"lOqr.py","timestamp":1725348746459},{"id":"vhO4.py","timestamp":1725348758493},{"id":"g6xA.py","timestamp":1725348780373},{"id":"HmJB.py","timestamp":1725348791584},{"id":"bT9O.py","timestamp":1725348813906},{"id":"P5or.py","timestamp":1725348825563},{"id":"r8JY.py","timestamp":1725348851193},{"id":"iqmd.py","timestamp":1725348917731}]}

View file

@ -0,0 +1,30 @@
import random
num_characters = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str):
for c in number:
if c not in num_characters:
number = number.replace(c, '')
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number btw 1 and 100: '))
except ValueError:
print('enter a number please')
continue
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,16 @@
import random
num = random.randint(1, 100)
for i in range(5):
guess = int(input('guess the number'))
if guess == num:
print('congratualtions you guessed correctly')
break
elif guess > num:
print('too high try again')
else:
print('too low try again')
print('you failed the number was ', num)

View file

@ -0,0 +1,32 @@
import random
num_characters = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str) -> str:
for c in number:
if c not in num_characters:
number = number.replace(c, '')
return number
num = random.randint(1, 100)
i = 0
while i < 5:
guess = input('guess the number btw 1 and 100: ')
guess = removeCharacters(guess)
if len(guess) == 0:
print('invalid input')
continue
guess = int(guess)
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,16 @@
import random
num = random.randint(1, 100)
for i in range(5):
guess = input('guess the number')
if guess == num:
print('congratualtions you guessed correctly')
break
elif guess > num:
print('too high try again')
else:
print('too low try again')
print('you failed the number was ', num)

View file

@ -0,0 +1,29 @@
import random
num_characters = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str):
for c in number:
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number btw 1 and 100: '))
except ValueError:
print('enter a number please')
continue
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,31 @@
import random
num_characters = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str) -> str:
for c in number:
if c not in num_characters:
number = number.replace(c, '')
return number
num = random.randint(1, 100)
i = 0
while i < 5:
guess = int(input('guess the number btw 1 and 100: '))
guess = removeCharacters(guess)
if len(guess) == 0:
print('invalid input')
continue
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)

View file

@ -0,0 +1,21 @@
import random
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number: '))
except ValueError:
print('enter a number please')
i = i - 1
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i = i + 1
print('you failed the number was ', num)

View file

@ -0,0 +1,29 @@
import random
num_characters = ('0', '1', '2', '3', '4', '5', '6', '7', '8', '9')
def removeCharacters(number: str):
for c in number:
if c not in num_characters
num = random.randint(1, 100)
i = 0
while i < 5:
try:
guess = int(input('guess the number btw 1 and 100: '))
except ValueError:
print('enter a number please')
continue
if guess < 1 or guess > 100:
print('enter number in range please')
continue
if guess == num:
print('congratualtions you guessed correctly: ')
break
elif guess > num:
print('too high try again: ')
else:
print('too low try again: ')
i += 1
print('you failed the number was ', num)