-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathasci.py
More file actions
47 lines (34 loc) · 1.1 KB
/
Copy pathasci.py
File metadata and controls
47 lines (34 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import pyfiglet
text = input("Enter your message: ")
ascii_art = pyfiglet.figlet_format(text)
print(ascii_art)
msg = input("Enter a message: ")
print("Reversed:", msg[::-1])
print("Uppercase:", msg.upper())
print("Lowercase:", msg.lower())
print("Title Case:", msg.title())
print("Capitalized:", msg.capitalize())
print("Length:", len(msg))
print("Is Alphanumeric:", msg.isalnum())
print("Is Alphabetic:", msg.isalpha())
print("Is Digit:", msg.isdigit())
print("Is Lowercase:", msg.islower())
print("Is Uppercase:", msg.isupper())
while True:
user_input = input("Ask me anything: ")
if "bye" in user_input.lower():
print("Nooo don’t leave me 😢")
break
print("Absolutely! That's why I wear socks on my hands.")
import random
number = random.randint(1, 20)
print("I’m thinking of a number between 1 and 20.")
while True:
guess = int(input("Your guess? "))
if guess == number:
print("Congratulations! You got it!")
break
elif guess < number:
print("Too low!")
else:
print("Too high!")