इंटरमीडिएट Python फॉर डेवलपर्स
Jasmin Ludolf
Senior Data Science Content Developer
# Printing
print("Password is accepted!")
Password is accepted!
# Checking data types
type(print)
builtin_function_or_method
# Password attempts
for attempt in range(1, 4):
print("Attempt", attempt)
Attempt 1
Attempt 2
Attempt 3
$$
$$
$$

# List of preparation times (minutes) preparation_times = [19.23, 15.67, 48.57, 23.45, 12.06, 34.56, 45.67]# Find the longest preparation time print(max(preparation_times))
48.57
# Find the shortest preparation time
print(min(preparation_times))
12.06
# Calculate the total preparation time
print(sum(preparation_times))
199.21
# Store total time total_time = sum(preparation_times)# Round to one decimal place print(round(total_time, 1))
199.2
# ऑर्डर की संख्या गिनें
print(len(preparation_times))
7
# औसत तैयारी समय निकालें
print(sum(preparation_times) / len(preparation_times))
28.4585714
# स्ट्रिंग की लंबाई
print(len("Burger Hub"))
10
# सूची को आरोही क्रम में सॉर्ट करें
print(sorted(preparation_times))
[12.06, 15.67, 19.23, 23.45, 34.56,
45.67, 48.57]
# स्ट्रिंग को अल्फ़ाबेटिकली सॉर्ट करें
print(sorted("George"))
['G', 'e', 'e', 'g', 'o', 'r']
# कुल तैयारी समय निकालें
print(sum(preparation_times))
199.21
# कुल तैयारी समय निकालें # जोड़ने के लिए वैरिएबल बनाएँ time_count = 0# तैयारी समयों पर लूप चलाएँ for time in preparation_times:# हर समय को time_count में जोड़ें time_count += timeprint(time_count)
sum() दोबारा उपयोग योग्य, छोटा, साफ़,
और त्रुटि-प्रवणता कम करता है!19.23
34.9
83.47
106.92
118.98
153.54
199.21
इंटरमीडिएट Python फॉर डेवलपर्स