Stuff for CS
🧩 Syntax:
#Jarvis Christian 5/7/25
#-----------------------------------------------------------------
# 3x a number generator
ui = input("Enter a number and I will tell you 3x it's value! \n")
while True:
try:
ui = int(ui)
print(ui * 3)
break
except ValueError:
ui = input("That wasn't a real number :P Enter a valid number!!!! \n")
#---------------------------------------------------------------------------------
#Minor or Not
Uinput = input("How old are you? \n")
while True:
try:
Uinput = int(Uinput)
if Uinput >=18:
print("You are NOT a minor unc _/\_ (T-T)")
break
else:
print("You are a minor")
break
except ValueError:
Uinput = input("Enter a valid number bruh \n")
#------------------------------------------------------------
#Count to twenty
x = 20
for i in range(1,x+1, 1):
print(i)
#------------------------------------------------------------
#Whats ur name
userInput = input("What is your name? ")
while True:
if userInput == "":
userInput = input("What is your name?")
else:
print("Welcome,", userInput)
break
#------------------------------------------------------------
#Random Number Generator
import random
randomNumber = random.randint(1,10)
userInput = input("I'm thinking of a number between 1 and 10. What do you think it is? ")
while True:
try:
userInput = int(userInput)
if userInput == randomNumber:
print("Yes, You guessed correctly!")
break
else:
print("Nope! My number was", randomNumber)
break
except ValueError:
userInput = input("Please enter a valid number!")